mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Fix billing graph when the period is zero or doesn't exist, before the fix a divide by zero error was happening when the billing api was being call for an image (#14623)
This commit is contained in:
parent
8176e726bc
commit
5121f10587
@ -192,9 +192,9 @@ function getRates($bill_id, $datefrom, $dateto, $dir_95th)
|
||||
$data['total_data'] = $mtot;
|
||||
$data['total_data_in'] = $mtot_in;
|
||||
$data['total_data_out'] = $mtot_out;
|
||||
$data['rate_average'] = ($mtot / $ptot * 8);
|
||||
$data['rate_average_in'] = ($mtot_in / $ptot * 8);
|
||||
$data['rate_average_out'] = ($mtot_out / $ptot * 8);
|
||||
$data['rate_average'] = ! empty($ptot) ? ($mtot / $ptot * 8) : 0;
|
||||
$data['rate_average_in'] = ! empty($ptot) ? ($mtot_in / $ptot * 8) : 0;
|
||||
$data['rate_average_out'] = ! empty($ptot) ? ($mtot_out / $ptot * 8) : 0;
|
||||
|
||||
// print_r($data);
|
||||
return $data;
|
||||
|
Loading…
Reference in New Issue
Block a user