Coverage should be back at 100%. Fixed some formatting too.

This commit is contained in:
James Cole
2014-08-17 21:17:31 +02:00
parent ae95d60c46
commit 9db8f78cd8
11 changed files with 464 additions and 101 deletions

View File

@@ -122,10 +122,12 @@ class PiggybankController extends BaseController
/**
* @param Piggybank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
* @throws Firefly\Exception\FireflyException
*/
public function modMoney(Piggybank $piggyBank)
{
var_dump(Input::all());
$amount = floatval(Input::get('amount'));
switch (Input::get('what')) {
default:
@@ -141,9 +143,13 @@ class PiggybankController extends BaseController
}
break;
case 'remove':
$maxRemove = $piggyBank->currentRelevantRep()->currentamount;
$rep = $piggyBank->currentRelevantRep();
$maxRemove = $rep->currentamount;
if (round($amount, 2) <= round($maxRemove, 2)) {
Session::flash('success', 'Amount updated!');
$this->_repository->modifyAmount($piggyBank, ($amount * -1));
} else {
Session::flash('warning', 'Could not!');
}
break;
}