mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-08 02:38:09 +00:00
Fix some charts.
This commit is contained in:
@@ -81,7 +81,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty('chart.category.all');
|
||||
$cache->addProperty($category->id);
|
||||
if ($cache->has()) {
|
||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
$start = $repository->firstUseDate($category) ?? $this->getDate();
|
||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
||||
@@ -216,7 +216,7 @@ class CategoryController extends Controller
|
||||
$cache->addProperty($accounts->pluck('id')->toArray());
|
||||
$cache->addProperty($category);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get());// @codeCoverageIgnore
|
||||
return response()->json($cache->get());// @codeCoverageIgnore
|
||||
}
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$expenses = $repository->periodExpenses(new Collection([$category]), $accounts, $start, $end);
|
||||
@@ -248,7 +248,7 @@ class CategoryController extends Controller
|
||||
$spent = $expenses[$category->id]['entries'][$period] ?? '0';
|
||||
$earned = $income[$category->id]['entries'][$period] ?? '0';
|
||||
$sum = bcadd($spent, $earned);
|
||||
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 12);
|
||||
$chartData[0]['entries'][$label] = round($spent, 12);
|
||||
$chartData[1]['entries'][$label] = round($earned, 12);
|
||||
$chartData[2]['entries'][$label] = round($sum, 12);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ class CategoryReportController extends Controller
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
@@ -262,7 +262,7 @@ class CategoryReportController extends Controller
|
||||
$labelOut = $category->id . '-out';
|
||||
$labelSumIn = $category->id . '-total-in';
|
||||
$labelSumOut = $category->id . '-total-out';
|
||||
$currentIncome = bcmul($income[$category->id] ?? '0','-1');
|
||||
$currentIncome = $income[$category->id] ?? '0';
|
||||
$currentExpense = $expenses[$category->id] ?? '0';
|
||||
|
||||
// add to sum:
|
||||
|
||||
@@ -86,7 +86,7 @@ class ReportController extends Controller
|
||||
/** @var AccountRepositoryInterface $accountRepository */
|
||||
$accountRepository = app(AccountRepositoryInterface::class);
|
||||
$filtered = $accounts->filter(
|
||||
function (Account $account) use ($accountRepository) {
|
||||
static function (Account $account) use ($accountRepository) {
|
||||
$includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth');
|
||||
$result = null === $includeNetWorth ? true : '1' === $includeNetWorth;
|
||||
if (false === $result) {
|
||||
@@ -97,6 +97,7 @@ class ReportController extends Controller
|
||||
}
|
||||
);
|
||||
|
||||
// TODO get liabilities and include those as well?
|
||||
|
||||
while ($current < $end) {
|
||||
// get balances by date, grouped by currency.
|
||||
|
||||
@@ -201,7 +201,7 @@ class TagReportController extends Controller
|
||||
$cache->addProperty($start);
|
||||
$cache->addProperty($end);
|
||||
if ($cache->has()) {
|
||||
//return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$format = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
|
||||
|
||||
Reference in New Issue
Block a user