Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix division by zero.
James Cole191401f32ba9
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 41bef35866..687f5afaef 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -61,7 +61,10 @@ class BudgetRepository implements BudgetRepositoryInterface$total = '0';$count = 0;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;$perDay = bcdiv($amount, $diff);$total = bcadd($total, $perDay);