summaryrefslogtreecommitdiff
path: root/app/Controller/Analytic.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/Analytic.php')
-rw-r--r--app/Controller/Analytic.php40
1 files changed, 38 insertions, 2 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
index 010fda09..ca2146ed 100644
--- a/app/Controller/Analytic.php
+++ b/app/Controller/Analytic.php
@@ -27,6 +27,40 @@ class Analytic extends Base
}
/**
+ * Show average Lead and Cycle time
+ *
+ * @access public
+ */
+ public function leadAndCycleTime()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ $this->projectDailyStats->updateTotals($project['id'], date('Y-m-d'));
+
+ $from = $this->request->getStringParam('from', date('Y-m-d', strtotime('-1week')));
+ $to = $this->request->getStringParam('to', date('Y-m-d'));
+
+ if (! empty($values)) {
+ $from = $values['from'];
+ $to = $values['to'];
+ }
+
+ $this->response->html($this->layout('analytic/lead_cycle_time', array(
+ 'values' => array(
+ 'from' => $from,
+ 'to' => $to,
+ ),
+ 'project' => $project,
+ 'average' => $this->projectAnalytic->getAverageLeadAndCycleTime($project['id']),
+ 'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to),
+ 'date_format' => $this->config->get('application_date_format'),
+ 'date_formats' => $this->dateParser->getAvailableFormats(),
+ 'title' => t('Lead and Cycle time for "%s"', $project['name']),
+ )));
+ }
+
+ /**
* Show average time spent by column
*
* @access public
@@ -104,6 +138,8 @@ class Analytic extends Base
$project = $this->getProject();
$values = $this->request->getValues();
+ $this->projectDailyColumnStats->updateTotals($project['id'], date('Y-m-d'));
+
$from = $this->request->getStringParam('from', date('Y-m-d', strtotime('-1week')));
$to = $this->request->getStringParam('to', date('Y-m-d'));
@@ -112,7 +148,7 @@ class Analytic extends Base
$to = $values['to'];
}
- $display_graph = $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2;
+ $display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2;
$this->response->html($this->layout($template, array(
'values' => array(
@@ -120,7 +156,7 @@ class Analytic extends Base
'to' => $to,
),
'display_graph' => $display_graph,
- 'metrics' => $display_graph ? $this->projectDailySummary->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
+ 'metrics' => $display_graph ? $this->projectDailyColumnStats->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
'project' => $project,
'date_format' => $this->config->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats(),