Merge pull request #4503 from Aethiran/develop

Fixed amountPerPeriod not respecting bill skips
This commit is contained in:
James Cole 2021-03-13 19:39:52 +00:00 committed by GitHub
commit e113225b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,8 +211,8 @@ class IndexController extends Controller
'monthly' => '12',
'weekly' => '52.17',
];
$yearAmount = bcmul($avg, $multiplies[$bill['repeat_freq']]);
Log::debug(sprintf('Amount per year is %s (%s * %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']]));
$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string)($bill['skip'] + 1)));
// per period:
$division = [