mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Fix #3202
This commit is contained in:
@@ -157,9 +157,9 @@ class BudgetController extends Controller
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return JsonResponse
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
||||
{
|
||||
@@ -414,7 +414,7 @@ class BudgetController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty('chart.budget.frontpage');
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
// return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
$budgets = $this->repository->getActiveBudgets();
|
||||
$chartData = [
|
||||
@@ -458,17 +458,16 @@ class BudgetController extends Controller
|
||||
$limit->end_date->formatLocalized($this->monthAndDayFormat)
|
||||
);
|
||||
}
|
||||
|
||||
$chartData[0]['entries'][$title] = bcmul($entry['sum'], '-1'); // spent
|
||||
$chartData[1]['entries'][$title] = 1 === bccomp($limit->amount, bcmul($entry['sum'], '-1')) ? bcadd($entry['sum'], $limit->amount)
|
||||
$sumSpent = bcmul($entry['sum'], '-1'); // spent
|
||||
$chartData[0]['entries'][$title] = 1 === bccomp($sumSpent, $limit->amount) ? $limit->amount : $sumSpent;
|
||||
$chartData[1]['entries'][$title] = 1 === bccomp($limit->amount, $sumSpent) ? bcadd($entry['sum'], $limit->amount)
|
||||
: '0';
|
||||
$chartData[2]['entries'][$title] = 1 === bccomp($limit->amount, bcmul($entry['sum'], '-1')) ?
|
||||
$chartData[2]['entries'][$title] = 1 === bccomp($limit->amount, $sumSpent) ?
|
||||
'0' : bcmul(bcadd($entry['sum'], $limit->amount), '-1');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = $this->generator->multiSet($chartData);
|
||||
$cache->store($data);
|
||||
|
||||
|
Reference in New Issue
Block a user