From b351e94c98cf21c1cfba193c0cc457ac6665dcc5 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Sat, 5 Sep 2026 15:18:51 +0200 Subject: [PATCH] fix(api): return task execution duration as float (#11636) --- app/Models/ScheduledTaskExecution.php | 2 +- tests/Feature/ModelFillableCreationTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/ScheduledTaskExecution.php b/app/Models/ScheduledTaskExecution.php index 1e26c7be3f..8f496fc1e6 100644 --- a/app/Models/ScheduledTaskExecution.php +++ b/app/Models/ScheduledTaskExecution.php @@ -39,7 +39,7 @@ class ScheduledTaskExecution extends BaseModel 'started_at' => 'datetime', 'finished_at' => 'datetime', 'retry_count' => 'integer', - 'duration' => 'decimal:2', + 'duration' => 'float', ]; } diff --git a/tests/Feature/ModelFillableCreationTest.php b/tests/Feature/ModelFillableCreationTest.php index 46d9c36daa..1e06ea22d3 100644 --- a/tests/Feature/ModelFillableCreationTest.php +++ b/tests/Feature/ModelFillableCreationTest.php @@ -1047,14 +1047,15 @@ it('creates ScheduledTaskExecution with all fillable attributes', function () { 'finished_at' => now()->toISOString(), 'started_at' => now()->subMinute()->toISOString(), 'retry_count' => 0, - 'duration' => 60, + 'duration' => '60.25', 'error_details' => null, ]); expect($execution->exists)->toBeTrue(); expect($execution->scheduled_task_id)->toBe($task->id); expect($execution->status)->toBe('success'); - expect((float) $execution->duration)->toBe(60.0); + expect($execution->duration)->toBe(60.25); + expect($execution->toArray()['duration'])->toBe(60.25); expect($execution->retry_count)->toBe(0); });