Remove array calls and fix various bugs.

This commit is contained in:
James Cole
2018-07-24 21:12:48 +02:00
parent abb249643f
commit 780a15fe4f
5 changed files with 163 additions and 85 deletions

View File

@@ -310,14 +310,17 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function getPiggyBanksWithAmount(): Collection
{
$currency = app('amount')->getDefaultCurrency();
$set = $this->getPiggyBanks();
foreach ($set as $piggy) {
$currentAmount = $piggy->currentRelevantRep()->currentamount ?? '0';
$piggy->name = $piggy->name . ' (' . app('amount')->formatAnything($currency, $currentAmount, false) . ')';
$currency = app('amount')->getDefaultCurrency();
$set = $this->getPiggyBanks();
/** @var PiggyBank $piggy */
foreach ($set as $piggy) {
$currentAmount = $this->getRepetition($piggy)->currentamount ?? '0';
$piggy->name = $piggy->name . ' (' . app('amount')->formatAnything($currency, $currentAmount, false) . ')';
}
return $set;
}