Billing: add peak in and out (#13006)

* feat(api): added max in/out per bill_history period

* chore(Docs): updated docs to include in/out max values

* chore(formatting): style-ci

* chore(db): update db-schema

* fix(db): reverted wrong changes in schema

* fix: wrong table name in migration

* feat(billing-history-frontend): added max in/out values to frontend bill-history

* chore: renamed to peak instead of min/max
This commit is contained in:
Bennet Gallein
2021-07-26 17:37:52 +02:00
committed by GitHub
parent e873768845
commit 574eb1f0f0
6 changed files with 51 additions and 6 deletions

View File

@@ -42,7 +42,7 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_id`') as $bill) {
// Send the current dir_95th to the getRates function so it knows to aggregate or return the max in/out value and highest direction
$dir_95th = $bill['dir_95th'];
if ($period > 0 && $dateto > $date_updated) {
if ($period['period'] > 0 && $dateto > $date_updated) {
$rate_data = getRates($bill['bill_id'], $datefrom, $dateto, $dir_95th);
$rate_95th = $rate_data['rate_95th'];
$dir_95th = $rate_data['dir_95th'];
@@ -102,6 +102,8 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_id`') as $bill) {
'traf_total' => $rate_data['total_data'],
'traf_in' => $rate_data['total_data_in'],
'traf_out' => $rate_data['total_data_out'],
'bill_peak_out' => $period['peak_out'],
'bill_peak_in' => $period['peak_in'],
'bill_used' => $used,
'bill_overuse' => $overuse,
'bill_percent' => $percent,
@@ -133,10 +135,10 @@ foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_id`') as $bill) {
];
dbInsert($update, 'bill_history');
echo ' Generated history! ';
}//end if
} //end if
echo "\n\n";
}//end if
} //end if
$i++;
}//end while
} //end while
}//end foreach