Fix bugs in computed attribute calculation

This commit is contained in:
Constantin Graf
2024-10-15 11:00:14 +02:00
committed by Constantin Graf
parent 69d3ff4f7b
commit 4c27f1a2de
4 changed files with 156 additions and 1 deletions

View File

@@ -450,6 +450,10 @@ class TimeEntryController extends Controller
$ids = $request->validated('ids');
$timeEntries = TimeEntry::query()
->whereBelongsTo($organization, 'organization')
->with([
'project',
'task',
])
->whereIn('id', $ids)
->get();
@@ -473,7 +477,17 @@ class TimeEntryController extends Controller
}
$project = $timeEntry->project;
$task = $timeEntry->task;
$timeEntry->delete();
if ($project !== null) {
RecalculateSpentTimeForProject::dispatch($project);
}
if ($task !== null) {
RecalculateSpentTimeForTask::dispatch($task);
}
$success->push($id);
}