James Cole 2023-12-19 20:18:28 +01:00
parent 9f0b4564cf
commit cbcadb6706
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -169,8 +169,9 @@ class IndexController extends Controller
'period' => $range,
'per_period' => '0',
];
// only fill in avg when bill is active.
if (count($bill['pay_dates']) > 0) {
if (null !== $bill['next_expected_match']) {
$avg = bcdiv(bcadd((string)$bill['amount_min'], (string)$bill['amount_max']), '2');
$avg = bcmul($avg, (string)count($bill['pay_dates']));
$sums[$groupOrder][$currencyId]['avg'] = bcadd($sums[$groupOrder][$currencyId]['avg'], $avg);