Add some forgotten code to the mobile piggy bank controller things.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-08-24 20:06:45 +02:00
parent d4f8c41d80
commit 5aadb29905
8 changed files with 157 additions and 69 deletions

View File

@@ -438,7 +438,9 @@ class AccountRepository implements AccountRepositoryInterface
$balance = Steam::balanceIgnoreVirtual($account, $date);
/** @var PiggyBank $p */
foreach ($account->piggybanks()->get() as $p) {
$balance = bcsub($balance, $p->currentRelevantRep()->currentamount);
$currentAmount = $p->currentRelevantRep()->currentamount ?? '0';
$balance = bcsub($balance, $currentAmount);
}
return $balance;

View File

@@ -118,7 +118,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
{
$set = $this->getPiggyBanks();
foreach ($set as $piggy) {
$piggy->name = $piggy->name . ' (' . Amount::format($piggy->currentRelevantRep()->currentamount, false) . ')';
$currentAmount = $piggy->currentRelevantRep()->currentamount ?? '0';
$piggy->name = $piggy->name . ' (' . Amount::format($currentAmount, false) . ')';
}
return $set;