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.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
index e03d8cab..bebb13fa 100644
--- a/app/Controller/Analytic.php
+++ b/app/Controller/Analytic.php
@@ -1,6 +1,7 @@
<?php
namespace Kanboard\Controller;
+use Kanboard\Model\Task as TaskModel;
/**
* Project Analytic controller
@@ -166,4 +167,32 @@ class Analytic extends Base
'title' => t($title, $project['name']),
)));
}
+
+ /**
+ * Show comparison between actual and estimated hours chart
+ *
+ * @access public
+ */
+ public function compareHours()
+ {
+ $project = $this->getProject();
+ $params = $this->getProjectFilters('analytic', 'compareHours');
+ $query = $this->taskFilter->search('status:all')->filterByProject($params['project']['id'])->getQuery();
+
+ $paginator = $this->paginator
+ ->setUrl('analytic', 'compareHours', array('project_id' => $project['id']))
+ ->setMax(30)
+ ->setOrder(TaskModel::TABLE.'.id')
+ ->setQuery($query)
+ ->calculate();
+
+ $stats = $this->projectAnalytic->getHoursByStatus($project['id']);
+
+ $this->response->html($this->layout('analytic/compare_hours', array(
+ 'project' => $project,
+ 'paginator' => $paginator,
+ 'metrics' => $stats,
+ 'title' => t('Compare hours for "%s"', $project['name']),
+ )));
+ }
}