Skip to content

Firefly III: a personal finances manager

Fixed a bug where the associated total amount for a bar would be too high.

James Colefd6e7fc1ab8a
diff --git a/app/lib/FireflyIII/Database/RepeatedExpense.php b/app/lib/FireflyIII/Database/RepeatedExpense.php
index 89c019bacd..e09463b023 100644
--- a/app/lib/FireflyIII/Database/RepeatedExpense.php
+++ b/app/lib/FireflyIII/Database/RepeatedExpense.php
@@ -95,9 +95,12 @@ class RepeatedExpense implements CUD, CommonDatabaseCalls, PiggybankInterface
$amountPerBar = floatval($piggyBank->targetamount) / $parts;
$cumulative = $amountPerBar;
/** @var PiggybankPart $bar */
- foreach ($bars as $bar) {
+ foreach ($bars as $index => $bar) {
$bar->setAmountPerBar($amountPerBar);
$bar->setCumulativeAmount($cumulative);
+ if($parts -1 == $index) {
+ $bar->setCumulativeAmount($piggyBank->targetamount);
+ }
$reminder = $piggyBank->reminders()
->where('startdate', $bar->getStartdate()->format('Y-m-d'))