From acba6839a6082e3e3800a733f8baea7c843fc02e Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 11 Oct 2014 21:11:10 -0400 Subject: Add 3 new fields for tasks: start date, time estimated and time spent --- app/Model/TimeTracking.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 app/Model/TimeTracking.php (limited to 'app/Model/TimeTracking.php') diff --git a/app/Model/TimeTracking.php b/app/Model/TimeTracking.php new file mode 100644 index 00000000..4ddddf12 --- /dev/null +++ b/app/Model/TimeTracking.php @@ -0,0 +1,45 @@ + 0, + 'time_estimated' => 0, + 'time_remaining' => 0, + ); + + foreach ($subtasks as &$subtask) { + $timesheet['time_estimated'] += $subtask['time_estimated']; + $timesheet['time_spent'] += $subtask['time_spent']; + } + + if ($timesheet['time_estimated'] == 0 && $timesheet['time_spent'] == 0) { + $timesheet['time_estimated'] = $task['time_estimated']; + $timesheet['time_spent'] = $task['time_spent']; + } + + $timesheet['time_remaining'] = $timesheet['time_estimated'] - $timesheet['time_spent']; + + return $timesheet; + } +} -- cgit v1.2.3