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

Update getJobProgression method in Log class to be moe efficient and clearer

parent 3c8059eb
No related branches found
No related tags found
1 merge request!1Include Wowa Training
Pipeline #5919 failed
......@@ -19,17 +19,13 @@ class Log extends Model
return "Calculation in progress...";
}
if ($wowa->status == Wowa::STATE_COLLECTION) {
$result = 'Evidences collection : ';
$log = self::where('job_id', '=', $wowa->id)
->where('training', '=', false)->orderBy('progression', 'desc')->first();
return $result . $log->progression;
} elseif ($wowa->status == Wowa::STATE_RUNNING) {
$result = 'Training : ';
return $log->progression;
} elseif ($wowa->status == Wowa::STATE_RUNNING || $wowa->status == Wowa::STATE_SUCCESS) {
$log = self::where('job_id', '=', $wowa->id)
->where('training', '=', true)->orderBy('progression', 'desc')->first();
return $result . ((($logs->progression + 1) / $wowa->generation_number) * 100);
} elseif ($wowa->status = Wowa::STATE_SUCCESS) {
return (($logs->progression + 1) / $wowa->generation_number) * 100;
return ((($log->progression + 1) / $wowa->generation_number) * 100);
} else {
return 'Error';
}
......
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