Various code cleanup.

This commit is contained in:
James Cole
2025-10-05 12:57:58 +02:00
parent 072212c112
commit 6341743cf9
169 changed files with 482 additions and 305 deletions

View File

@@ -45,6 +45,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Safe\Exceptions\JsonException;
use function Safe\json_encode;
/**
@@ -482,7 +483,13 @@ class AccountController extends Controller
/**
* Shows overview of account during a single period.
*
* @param Account $account
* @param Carbon $start
* @param Carbon $end
*
* @return JsonResponse
* @throws FireflyException
* @throws JsonException
*/
public function period(Account $account, Carbon $start, Carbon $end): JsonResponse
{
@@ -571,7 +578,7 @@ class AccountController extends Controller
$label = $current->isoFormat($format);
$return[$key]['entries'][$label] = $amount;
}
$current = app('navigation')->addPeriod($current, $step, 0);
$current = app('navigation')->addPeriod($current, $step);
// here too, to fix #8041, the data is corrected to the end of the period.
$current = app('navigation')->endOfX($current, $step, null);
}

View File

@@ -40,6 +40,8 @@ use FireflyIII\Support\Http\Controllers\ChartGeneration;
use FireflyIII\Support\Http\Controllers\DateCalculation;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class CategoryController.
@@ -66,7 +68,6 @@ class CategoryController extends Controller
* Show an overview for a category for all time, per month/week/year.
* TODO test method, for category refactor.
*
* @throws FireflyException
*/
public function all(Category $category): JsonResponse
{
@@ -256,7 +257,12 @@ class CategoryController extends Controller
* Chart for a specific period.
* TODO test me, for category refactor.
*
* @throws FireflyException
* @param Category $category
* @param Carbon $date
*
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function specificPeriod(Category $category, Carbon $date): JsonResponse
{

View File

@@ -59,7 +59,6 @@ class PiggyBankController extends Controller
*
* TODO this chart is not multi currency aware.
*
* @throws FireflyException
*/
public function history(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank): JsonResponse
{
@@ -95,7 +94,7 @@ class PiggyBankController extends Controller
$currentSum = $filtered->sum('amount');
$label = $oldest->isoFormat((string) trans('config.month_and_day_js', [], $locale));
$chartData[$label] = $currentSum;
$oldest = app('navigation')->addPeriod($oldest, $step, 0);
$oldest = app('navigation')->addPeriod($oldest, $step);
}
$finalFiltered = $set->filter(
static fn (PiggyBankEvent $event) => $event->date->lte($today)

View File

@@ -260,7 +260,7 @@ class ReportController extends Controller
$expense['entries'][$title] = '0';
}
$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange);
}
Log::debug('End of sub-loop');