Code cleanup

This commit is contained in:
James Cole
2024-12-22 08:43:12 +01:00
parent 5751f7e5a3
commit 565bd87959
574 changed files with 4600 additions and 4604 deletions

View File

@@ -47,7 +47,7 @@ class ChartJsGenerator implements GeneratorInterface
$amounts = array_column($data, 'amount');
$next = next($amounts);
$sortFlag = SORT_ASC;
if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {
if (!is_bool($next) && 1 === bccomp((string) $next, '0')) {
$sortFlag = SORT_DESC;
}
array_multisort($amounts, $sortFlag, $data);
@@ -56,7 +56,7 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0;
foreach ($data as $key => $valueArray) {
// make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string)$valueArray['amount']);
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $valueArray['amount']);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
$chartData['labels'][] = $key;
@@ -154,7 +154,7 @@ class ChartJsGenerator implements GeneratorInterface
// different sort when values are positive and when they're negative.
asort($data);
$next = next($data);
if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {
if (!is_bool($next) && 1 === bccomp((string) $next, '0')) {
// next is positive, sort other way around.
arsort($data);
}
@@ -163,7 +163,7 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0;
foreach ($data as $key => $value) {
// make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string)$value);
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $value);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['labels'][] = $key;

View File

@@ -168,9 +168,9 @@ class MonthReportGenerator implements ReportGeneratorInterface
'journals' => $journals,
'currency' => $currency,
'exists' => 0 !== count($journals),
'end' => $this->end->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),
'end' => $this->end->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
'endBalance' => app('steam')->balance($account, $this->end),
'dayBefore' => $date->isoFormat((string)trans('config.month_and_day_moment_js', [], $locale)),
'dayBefore' => $date->isoFormat((string) trans('config.month_and_day_moment_js', [], $locale)),
'dayBeforeBalance' => $dayBeforeBalance,
];
}