Ensure time log is iterable

This commit is contained in:
David Bomba 2023-09-24 12:16:51 +10:00
parent 611f43911e
commit 772ede661d

View File

@ -80,8 +80,8 @@ class UpdateCalculatedFields
$project->tasks->each(function ($task) use (&$duration) { $project->tasks->each(function ($task) use (&$duration) {
if(is_iterable($task->time_log)) {
foreach(json_decode($task->time_log) as $log){ foreach(json_decode($task->time_log) as $log) {
$start_time = $log[0]; $start_time = $log[0];
$end_time = $log[1] == 0 ? time() : $log[1]; $end_time = $log[1] == 0 ? time() : $log[1];
@ -89,6 +89,7 @@ class UpdateCalculatedFields
$duration += $end_time - $start_time; $duration += $end_time - $start_time;
} }
}
}); });