Code cleanup. Moving closer to new release.

This commit is contained in:
James Cole
2016-05-20 17:53:03 +02:00
parent 87f9ca3bb2
commit a74a646777
19 changed files with 248 additions and 191 deletions

View File

@@ -299,16 +299,23 @@ class AccountRepository implements AccountRepositoryInterface
if ($diff < 0 && $account->startBalance > 0) {
// percentage lost compared to start.
$pct = (($diff * -1) / $account->startBalance) * 100;
} else {
if ($diff >= 0 && $account->startBalance > 0) {
$pct = ($diff / $account->startBalance) * 100;
} else {
$pct = 100;
}
$pct = $pct > 100 ? 100 : $pct;
$account->difference = $diff;
$account->percentage = round($pct);
return;
}
if ($diff >= 0 && $account->startBalance > 0) {
$pct = ($diff / $account->startBalance) * 100;
$pct = $pct > 100 ? 100 : $pct;
$account->difference = $diff;
$account->percentage = round($pct);
return;
}
$pct = $pct > 100 ? 100 : $pct;
$account->difference = $diff;
$account->percentage = round($pct);
$account->percentage = 100;
}
);