add duration
This commit is contained in:
@@ -58,7 +58,12 @@ class User extends Authenticatable
|
||||
|
||||
public function stopCurrentTimeTracker(): void
|
||||
{
|
||||
$this->currentTimeTracker()->update(['end_at' => now()]);
|
||||
$end = now();
|
||||
$delay = $end->diffInSeconds($this->currentTimeTracker->start_at);
|
||||
$toDo = $this->currentTimeTracker->toDo;
|
||||
$toDo->duration = $toDo->duration + $delay;
|
||||
$toDo->save();
|
||||
$this->currentTimeTracker()->update(['end_at' => $end]);
|
||||
$this->time_tracker_id = null;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user