Code cleanup.

This commit is contained in:
James Cole 2024-01-14 05:10:05 +01:00
parent 5c81e98218
commit 458402aaff
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -32,7 +32,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Support\Facades\Navigation;
use FireflyIII\Support\Http\Controllers\BasicDataSupport;
use FireflyIII\Support\Http\Controllers\ChartGeneration;
use Illuminate\Http\JsonResponse;
@ -112,7 +111,7 @@ class ReportController extends Controller
$label = $current->isoFormat((string)trans('config.month_and_day_js', [], $locale));
if (!array_key_exists($currencyId, $chartData)) {
$chartData[$currencyId] = [
'label' => 'Net worth in ' . $netWorthItem['currency_name'],
'label' => 'Net worth in '.$netWorthItem['currency_name'],
'type' => 'line',
'currency_symbol' => $netWorthItem['currency_symbol'],
'currency_code' => $netWorthItem['currency_code'],
@ -147,7 +146,6 @@ class ReportController extends Controller
return response()->json($cache->get());
}
app('log')->debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
$format = app('navigation')->preferredCarbonFormat($start, $end);
$titleFormat = app('navigation')->preferredCarbonLocalizedFormat($start, $end);
@ -219,7 +217,7 @@ class ReportController extends Controller
// #8374. Sloppy fix for yearly charts. Not really interested in a better fix with v2 layout and all.
if ('1Y' === $preferredRange) {
$currentEnd = Navigation::endOfPeriod($currentEnd, $preferredRange);
$currentEnd = app('navigation')->endOfPeriod($currentEnd, $preferredRange);
}
while ($currentStart <= $currentEnd) {
$key = $currentStart->format($format);
@ -227,7 +225,7 @@ class ReportController extends Controller
$income['entries'][$title] = app('steam')->bcround($currency[$key]['earned'] ?? '0', $currency['currency_decimal_places']);
$expense['entries'][$title] = app('steam')->bcround($currency[$key]['spent'] ?? '0', $currency['currency_decimal_places']);
$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
};
}
$chartData[] = $income;
$chartData[] = $expense;