Make sure amounts are formatted, and fixed some issues.

This commit is contained in:
James Cole
2017-06-04 23:39:26 +02:00
parent 82e74a2afd
commit a487c7b4b2
15 changed files with 301 additions and 71 deletions

View File

@@ -240,10 +240,12 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*/
public function getPiggyBanksWithAmount(): Collection
{
$currency = Amount::getDefaultCurrency();
$set = $this->getPiggyBanks();
foreach ($set as $piggy) {
$currentAmount = $piggy->currentRelevantRep()->currentamount ?? '0';
$piggy->name = $piggy->name . ' (' . Amount::format($currentAmount, false) . ')';
$piggy->name = $piggy->name . ' (' . Amount::formatAnything($currency, $currentAmount, false) . ')';
}
return $set;