Move code to repository.

This commit is contained in:
James Cole
2018-02-17 10:47:32 +01:00
parent c6da990748
commit 7bbfb692de
5 changed files with 36 additions and 9 deletions

View File

@@ -45,9 +45,8 @@ class FrontpageController extends Controller
$info = [];
/** @var PiggyBank $piggyBank */
foreach ($set as $piggyBank) {
$rep = $piggyBank->currentRelevantRep();
$amount = strval($rep->currentamount);
if (null !== $rep->id && 1 === bccomp($amount, '0')) {
$amount = $repository->getCurrentAmount($piggyBank);
if (1 === bccomp($amount, '0')) {
// percentage!
$pct = round(($amount / $piggyBank->targetamount) * 100);