From 61c6b1438421fabbd2a65576eaf1b4c573d3a6ba Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Tue, 5 Mar 2024 22:00:23 +0000 Subject: [PATCH] stats: Fix some arithmetic errors for empty stats tables --- stats/pages_in_states.php | 2 +- stats/round_backlog.php | 2 +- stats/round_backlog_days.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stats/pages_in_states.php b/stats/pages_in_states.php index 58885db0cd..4bc9c7082c 100644 --- a/stats/pages_in_states.php +++ b/stats/pages_in_states.php @@ -31,7 +31,7 @@ // --------------- $stage_labels[] = 'New'; -$unavail_n_pages[] = $n_pages_[PROJ_NEW]; +$unavail_n_pages[] = $n_pages_[PROJ_NEW] ?? 0; $waiting_n_pages[] = 0; $available_n_pages[] = 0; $progordone_n_pages[] = 0; diff --git a/stats/round_backlog.php b/stats/round_backlog.php index 19e6c3a5de..1df3d6fceb 100644 --- a/stats/round_backlog.php +++ b/stats/round_backlog.php @@ -34,7 +34,7 @@ function _get_round_backlog_data() $stats_total = array_sum($stats); // calculate the goal percent as 100 / number_of_phases -$goal_percent = ceil(100 / count($stats)); +$goal_percent = ceil(100 / min(1, count($stats))); // colors $barColors = []; diff --git a/stats/round_backlog_days.php b/stats/round_backlog_days.php index bf6a2ff828..58ac26442b 100644 --- a/stats/round_backlog_days.php +++ b/stats/round_backlog_days.php @@ -55,7 +55,7 @@ function _get_round_backlog_days_data() $stats_total = array_sum($stats); // calculate the goal percent as 100 / number_of_phases -$goal_percent = ceil(100 / count($stats)); +$goal_percent = ceil(100 / min(1, count($stats))); // colors $barColors = [];