Update budget limit #508

This commit is contained in:
James Cole
2016-12-29 20:52:02 +01:00
parent a58cd83ea7
commit 497400587d
3 changed files with 13 additions and 22 deletions

View File

@@ -78,14 +78,13 @@ class BudgetController extends Controller
$start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$viewRange = Preferences::get('viewRange', '1M')->data;
$limitRepetition = $repository->updateLimitAmount($budget, $start, $end, $viewRange, $amount);
$budgetLimit = $repository->updateLimitAmount($budget, $start, $end, $amount);
if ($amount == 0) {
$limitRepetition = null;
$budgetLimit = null;
}
Preferences::mark();
return Response::json(['name' => $budget->name, 'repetition' => $limitRepetition ? $limitRepetition->id : 0, 'amount' => $amount]);
return Response::json(['name' => $budget->name, 'limit' => $budgetLimit ? $budgetLimit->id : 0, 'amount' => $amount]);
}