From fd6e7fc1ab8a8dbcbbf489d591b25aead6a74663 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 24 Nov 2014 18:08:20 +0100 Subject: [PATCH] Fixed a bug where the associated total amount for a bar would be too high. --- app/lib/FireflyIII/Database/RepeatedExpense.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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'))