From 8768a4e3699c5b9235d8c834ad7689ae66ef36aa Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 22 Mar 2016 20:44:15 -0400 Subject: Fixes cycle time calculation when the start date is defined in the future --- app/Model/ProjectDailyStats.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/Model') diff --git a/app/Model/ProjectDailyStats.php b/app/Model/ProjectDailyStats.php index 957ad51d..974f5813 100644 --- a/app/Model/ProjectDailyStats.php +++ b/app/Model/ProjectDailyStats.php @@ -56,12 +56,19 @@ class ProjectDailyStats extends Base */ public function getRawMetrics($project_id, $from, $to) { - return $this->db->table(self::TABLE) + $metrics = $this->db->table(self::TABLE) ->columns('day', 'avg_lead_time', 'avg_cycle_time') ->eq('project_id', $project_id) ->gte('day', $from) ->lte('day', $to) ->asc('day') ->findAll(); + + foreach ($metrics as &$metric) { + $metric['avg_lead_time'] = (int) $metric['avg_lead_time']; + $metric['avg_cycle_time'] = (int) $metric['avg_cycle_time']; + } + + return $metrics; } } -- cgit v1.2.3