Skip to content
Snippets Groups Projects
Commit 18c3e719 authored by a.croix's avatar a.croix
Browse files

Add condition to Log class to avoid exception if nothing is in the logs table

parent e0759255
No related branches found
No related tags found
1 merge request!1Include Wowa Training
Pipeline #5834 passed
......@@ -15,6 +15,9 @@ class Log extends Model
public static function getJobProgression(Wowa $wowa)
{
$logs = self::where('job_id', '=', $wowa->id)->orderBy('generation', 'desc')->first();
if (!is_object($logs)) {
return "Not begin yet";
}
$generation = $logs->generation + 1;
$generation_number = $wowa->generation_number;
return ($generation / $generation_number) * 100;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment