Improve pull-request that compare hours

This commit is contained in:
Frederic Guillot
2015-12-14 22:13:11 -05:00
parent db7a9ddf5f
commit 9e1f4fa6c7
5 changed files with 16 additions and 19 deletions

View File

@@ -1,6 +1,10 @@
Version 1.0.23 (unreleased) Version 1.0.23 (unreleased)
--------------------------- ---------------------------
New features:
- Add report to compare working hours between open and closed tasks
Bug fixes: Bug fixes:
- Fix wrong constant name that cause a PHP error in project management section - Fix wrong constant name that cause a PHP error in project management section

View File

@@ -173,21 +173,19 @@ class Analytic extends Base
* *
* @access public * @access public
*/ */
public function compareHours() public function compareHours()
{ {
$project = $this->getProject(); $project = $this->getProject();
$params = $this->getProjectFilters('analytic', 'compareHours'); $params = $this->getProjectFilters('analytic', 'compareHours');
$query = $this->taskFilter->search('status:all')->filterByProject($params['project']['id'])->getQuery(); $query = $this->taskFilter->search('status:all')->filterByProject($params['project']['id'])->getQuery();
$paginator = $this->paginator $paginator = $this->paginator
->setUrl('analytics', 'compare_hours') ->setUrl('analytic', 'compareHours', array('project_id' => $project['id']))
->setMax(30) ->setMax(30)
->setOrder(TaskModel::TABLE.'.id') ->setOrder(TaskModel::TABLE.'.id')
->setQuery($query) ->setQuery($query)
->calculate(); ->calculate();
$stats = $this->projectAnalytic->getHoursByStatus($project['id']); $stats = $this->projectAnalytic->getHoursByStatus($project['id']);
$this->response->html($this->layout('analytic/compare_hours', array( $this->response->html($this->layout('analytic/compare_hours', array(
@@ -195,6 +193,6 @@ class Analytic extends Base
'paginator' => $paginator, 'paginator' => $paginator,
'metrics' => $stats, 'metrics' => $stats,
'title' => t('Compare hours for "%s"', $project['name']), 'title' => t('Compare hours for "%s"', $project['name']),
))); )));
} }
} }

View File

@@ -202,14 +202,14 @@ class ProjectAnalytic extends Base
// Init values // Init values
$stats['closed'] = array( $stats['closed'] = array(
'time_spent' => 0, 'time_spent' => 0,
'time_estimated' => 0, 'time_estimated' => 0,
); );
$stats['open'] = array(
'time_spent' => 0,
'time_estimated' => 0,
);
$stats['open'] = array(
'time_spent' => 0,
'time_estimated' => 0,
);
// Add times spent and estimated to each status // Add times spent and estimated to each status
foreach ($tasks as &$task) { foreach ($tasks as &$task) {

File diff suppressed because one or more lines are too long

View File

@@ -28,11 +28,6 @@ CompareHoursColumnChart.prototype.execute = function() {
x: { x: {
type: 'category', type: 'category',
categories: categories categories: categories
},
y: {
tick: {
format: this.app.formatDuration
}
} }
}, },
legend: { legend: {