mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
Divide by zero.
This commit is contained in:
parent
d287ae97f8
commit
85f484e73c
@ -166,7 +166,7 @@ class ImportController extends Controller
|
||||
*/
|
||||
public function json(ImportJob $job)
|
||||
{
|
||||
$result = [
|
||||
$result = [
|
||||
'showPercentage' => false,
|
||||
'status' => $job->status,
|
||||
'key' => $job->key,
|
||||
@ -179,11 +179,16 @@ class ImportController extends Controller
|
||||
'stepsDone' => $job->extended_status['steps_done'],
|
||||
'statusText' => trans('firefly.import_status_' . $job->status),
|
||||
];
|
||||
$percentage = 0;
|
||||
if ($job->extended_status['total_steps'] !== 0) {
|
||||
$percentage = round(($job->extended_status['steps_done'] / $job->extended_status['total_steps']) * 100, 0);
|
||||
}
|
||||
|
||||
if ($job->status === 'import_running') {
|
||||
$result['started'] = true;
|
||||
$result['running'] = true;
|
||||
$result['showPercentage'] = true;
|
||||
$result['percentage'] = round(($job->extended_status['steps_done'] / $job->extended_status['total_steps']) * 100, 0);
|
||||
$result['percentage'] = $percentage;
|
||||
}
|
||||
|
||||
return Response::json($result);
|
||||
|
Loading…
Reference in New Issue
Block a user