mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 02:52:44 +00:00
Fix division by zero.
This commit is contained in:
@@ -61,7 +61,10 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
$total = '0';
|
$total = '0';
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($budget->budgetlimits as $limit) {
|
foreach ($budget->budgetlimits as $limit) {
|
||||||
$diff = (string)$limit->start_date->diffInDays($limit->end_date);
|
$diff = (string)$limit->start_date->diffInDays($limit->end_date);
|
||||||
|
if (bccomp('0', $diff) === 0) {
|
||||||
|
$diff = '1';
|
||||||
|
}
|
||||||
$amount = (string)$limit->amount;
|
$amount = (string)$limit->amount;
|
||||||
$perDay = bcdiv($amount, $diff);
|
$perDay = bcdiv($amount, $diff);
|
||||||
$total = bcadd($total, $perDay);
|
$total = bcadd($total, $perDay);
|
||||||
|
Reference in New Issue
Block a user