🤖 Auto commit for release 'develop' on 2025-08-05

This commit is contained in:
JC5
2025-08-05 13:53:33 +02:00
parent 1049a8314d
commit 489b7c12e5
14 changed files with 239 additions and 42 deletions

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace FireflyIII\Support\JsonApi\Enrichments;
use Carbon\Carbon;
@@ -39,7 +41,7 @@ class CategoryEnrichment implements EnrichmentInterface
return $collection;
}
public function enrichSingle(Model|array $model): array|Model
public function enrichSingle(array|Model $model): array|Model
{
Log::debug(__METHOD__);
$collection = new Collection([$model]);
@@ -100,9 +102,10 @@ class CategoryEnrichment implements EnrichmentInterface
private function collectNotes(): void
{
$notes = Note::query()->whereIn('noteable_id', $this->ids)
->whereNotNull('notes.text')
->where('notes.text', '!=', '')
->where('noteable_type', Category::class)->get(['notes.noteable_id', 'notes.text'])->toArray();
->whereNotNull('notes.text')
->where('notes.text', '!=', '')
->where('noteable_type', Category::class)->get(['notes.noteable_id', 'notes.text'])->toArray()
;
foreach ($notes as $note) {
$this->notes[(int)$note['noteable_id']] = (string)$note['text'];
}
@@ -116,9 +119,9 @@ class CategoryEnrichment implements EnrichmentInterface
$opsRepository = app(OperationsRepositoryInterface::class);
$opsRepository->setUser($this->user);
$opsRepository->setUserGroup($this->userGroup);
$expenses = $opsRepository->collectExpenses($this->start, $this->end, null, $this->collection);
$income = $opsRepository->collectIncome($this->start, $this->end, null, $this->collection);
$transfers = $opsRepository->collectTransfers($this->start, $this->end, null, $this->collection);
$expenses = $opsRepository->collectExpenses($this->start, $this->end, null, $this->collection);
$income = $opsRepository->collectIncome($this->start, $this->end, null, $this->collection);
$transfers = $opsRepository->collectTransfers($this->start, $this->end, null, $this->collection);
foreach ($this->collection as $item) {
$id = (int)$item->id;
$this->spent[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($expenses, $item, 'negative', false));
@@ -130,5 +133,4 @@ class CategoryEnrichment implements EnrichmentInterface
}
}
}
}

View File

@@ -583,7 +583,7 @@ class Navigation
*/
public function preferredEndOfPeriod(Carbon $start, Carbon $end): string
{
$diff = $start->diffInMonths($end, true);
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
return 'endOfMonth';
}
@@ -601,7 +601,7 @@ class Navigation
*/
public function preferredRangeFormat(Carbon $start, Carbon $end): string
{
$diff = $start->diffInMonths($end, true);
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
return '1M';
}
@@ -619,7 +619,7 @@ class Navigation
*/
public function preferredSqlFormat(Carbon $start, Carbon $end): string
{
$diff = $start->diffInMonths($end, true);
$diff = $start->diffInMonths($end, true);
if ($diff >= 1.001) {
return '%Y-%m';
}