Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix bad compare.
James Cole4b701dfc4c36
diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.phpindex dd6a74129b..e1bbd05ad1 100644--- a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php+++ b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php@@ -302,22 +302,21 @@ class PiggyBankEnrichment implements EnrichmentInterfaceif (null === $targetAmount || !$targetDate instanceof Carbon || !$startDate instanceof Carbon) {return '0';}- $savePerMonth = '0';if (1 === bccomp($targetAmount, $currentAmount)) {$diffInMonths = ceil($startDate->diffInMonths($targetDate));$remainingAmount = bcsub($targetAmount, $currentAmount);// more than 1 month to go and still need money to save:if ($diffInMonths > 0 && 1 === bccomp($remainingAmount, '0')) {- $savePerMonth = bcdiv($remainingAmount, (string) $diffInMonths);+ return bcdiv($remainingAmount, (string) $diffInMonths);}// less than 1 month to go but still need money to save:- if (0 === $diffInMonths && 1 === bccomp($remainingAmount, '0')) {- $savePerMonth = $remainingAmount;+ if (1 === bccomp($remainingAmount, '0')) {+ return $remainingAmount;}}- return $savePerMonth;+ return '0';}}