diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php index f31870e0a..41fe7169e 100644 --- a/app/Controller/Analytic.php +++ b/app/Controller/Analytic.php @@ -34,24 +34,12 @@ class Analytic extends Base public function tasks() { $project = $this->getProject(); - $metrics = $this->projectAnalytic->getTaskRepartition($project['id']); - if ($this->request->isAjax()) { - $this->response->json(array( - 'metrics' => $metrics, - 'labels' => array( - 'column_title' => t('Column'), - 'nb_tasks' => t('Number of tasks'), - ) - )); - } - else { - $this->response->html($this->layout('analytic/tasks', array( - 'project' => $project, - 'metrics' => $metrics, - 'title' => t('Task repartition for "%s"', $project['name']), - ))); - } + $this->response->html($this->layout('analytic/tasks', array( + 'project' => $project, + 'metrics' => $this->projectAnalytic->getTaskRepartition($project['id']), + 'title' => t('Task repartition for "%s"', $project['name']), + ))); } /** @@ -62,24 +50,12 @@ class Analytic extends Base public function users() { $project = $this->getProject(); - $metrics = $this->projectAnalytic->getUserRepartition($project['id']); - if ($this->request->isAjax()) { - $this->response->json(array( - 'metrics' => $metrics, - 'labels' => array( - 'user' => t('User'), - 'nb_tasks' => t('Number of tasks'), - ) - )); - } - else { - $this->response->html($this->layout('analytic/users', array( - 'project' => $project, - 'metrics' => $metrics, - 'title' => t('User repartition for "%s"', $project['name']), - ))); - } + $this->response->html($this->layout('analytic/users', array( + 'project' => $project, + 'metrics' => $this->projectAnalytic->getUserRepartition($project['id']), + 'title' => t('User repartition for "%s"', $project['name']), + ))); } /** @@ -100,30 +76,20 @@ class Analytic extends Base $to = $values['to']; } - if ($this->request->isAjax()) { - $this->response->json(array( - 'columns' => array_values($this->board->getColumnsList($project['id'])), - 'metrics' => $this->projectDailySummary->getRawMetrics($project['id'], $from, $to), - 'labels' => array( - 'column' => t('Column'), - 'day' => t('Date'), - 'total' => t('Tasks'), - ) - )); - } - else { - $this->response->html($this->layout('analytic/cfd', array( - 'values' => array( - 'from' => $from, - 'to' => $to, - ), - 'display_graph' => $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2, - 'project' => $project, - 'date_format' => $this->config->get('application_date_format'), - 'date_formats' => $this->dateParser->getAvailableFormats(), - 'title' => t('Cumulative flow diagram for "%s"', $project['name']), - ))); - } + $display_graph = $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2; + + $this->response->html($this->layout('analytic/cfd', array( + 'values' => array( + 'from' => $from, + 'to' => $to, + ), + 'display_graph' => $display_graph, + 'metrics' => $display_graph ? $this->projectDailySummary->getAggregatedMetrics($project['id'], $from, $to) : array(), + 'project' => $project, + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), + 'title' => t('Cumulative flow diagram for "%s"', $project['name']), + ))); } /** @@ -144,27 +110,19 @@ class Analytic extends Base $to = $values['to']; } - if ($this->request->isAjax()) { - $this->response->json(array( - 'metrics' => $this->projectDailySummary->getRawMetricsByDay($project['id'], $from, $to), - 'labels' => array( - 'day' => t('Date'), - 'score' => t('Complexity'), - ) - )); - } - else { - $this->response->html($this->layout('analytic/burndown', array( - 'values' => array( - 'from' => $from, - 'to' => $to, - ), - 'display_graph' => $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2, - 'project' => $project, - 'date_format' => $this->config->get('application_date_format'), - 'date_formats' => $this->dateParser->getAvailableFormats(), - 'title' => t('Burndown chart for "%s"', $project['name']), - ))); - } + $display_graph = $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2; + + $this->response->html($this->layout('analytic/burndown', array( + 'values' => array( + 'from' => $from, + 'to' => $to, + ), + 'display_graph' => $display_graph, + 'metrics' => $display_graph ? $this->projectDailySummary->getAggregatedMetrics($project['id'], $from, $to, 'score') : array(), + 'project' => $project, + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), + 'title' => t('Burndown chart for "%s"', $project['name']), + ))); } } diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index bb3c7c81f..82f9534cb 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 7d28b2196..b004905b6 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index a169abfaa..8aa56f6c4 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 00514ab10..601ab9fdf 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 4a792d077..4f077e931 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -945,4 +945,7 @@ return array( 'New due date: %B %e, %Y' => 'Nouvelle date d\'échéance : %d/%m/%Y', 'Start date changed: %B %e, %Y' => 'Date de début modifiée : %d/%m/%Y', '%k:%M %p' => '%H:%M', + '%%Y-%%m-%%d' => '%%d/%%m/%%Y', + 'Total for all columns' => 'Total pour toutes les colonnes', + 'You need at least 2 days of data to show the chart.' => 'Vous avez besoin d\'au minimum 2 jours de données pour afficher le graphique.', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index dc5dbeeb0..6c1861eb1 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 950bfcd0b..7bfa506a4 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 7c64d54dd..210621d00 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index d7111b383..9e0cf6fe4 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 8e2ac4a0d..d2650a899 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index f94f09110..041434a2f 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 1f3be94ff..7e94ecbbf 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 028b21e4e..8ac8ea315 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 93fe05b52..770a68d4e 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 122c5f73f..b1fb04175 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 31f2fd397..cdd4d8cfc 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 0260aa26a..60634686e 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -943,4 +943,7 @@ return array( // 'New due date: %B %e, %Y' => '', // 'Start date changed: %B %e, %Y' => '', // '%k:%M %p' => '', + // '%%Y-%%m-%%d' => '', + // 'Total for all columns' => '', + // 'You need at least 2 days of data to show the chart.' => '', ); diff --git a/app/Model/ProjectDailySummary.php b/app/Model/ProjectDailySummary.php index 65a612f6c..acffa3a96 100644 --- a/app/Model/ProjectDailySummary.php +++ b/app/Model/ProjectDailySummary.php @@ -149,9 +149,10 @@ class ProjectDailySummary extends Base * @param integer $project_id Project id * @param string $from Start date (ISO format YYYY-MM-DD) * @param string $to End date + * @param string $column Column to aggregate * @return array */ - public function getAggregatedMetrics($project_id, $from, $to) + public function getAggregatedMetrics($project_id, $from, $to, $column = 'total') { $columns = $this->board->getColumnsList($project_id); $column_ids = array_keys($columns); @@ -172,7 +173,7 @@ class ProjectDailySummary extends Base $aggregates[$record['day']] = array($record['day']); } - $aggregates[$record['day']][$record['column_id']] = $record['total']; + $aggregates[$record['day']][$record['column_id']] = $record[$column]; } // Aggregate by row diff --git a/app/Template/analytic/burndown.php b/app/Template/analytic/burndown.php index 839573bea..48a4c1c17 100644 --- a/app/Template/analytic/burndown.php +++ b/app/Template/analytic/burndown.php @@ -6,7 +6,7 @@
= t('Not enough data to show the graph.') ?>
= t('Not enough data to show the graph.') ?>
+= t('You need at least 2 days of data to show the chart.') ?>