Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(api): return task execution duration as float (#11636)

Andras Bacsaib351e94c98cf
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);
});