mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
🤖 Auto commit for release 'develop' on 2025-09-15
This commit is contained in:
@@ -95,8 +95,8 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
|
||||
private function collectIds(): void
|
||||
{
|
||||
$this->start = $this->collection->min('start_date') ?? Carbon::now()->startOfMonth();
|
||||
$this->end = $this->collection->max('end_date') ?? Carbon::now()->endOfMonth();
|
||||
$this->start = $this->collection->min('start_date') ?? Carbon::now()->startOfMonth();
|
||||
$this->end = $this->collection->max('end_date') ?? Carbon::now()->endOfMonth();
|
||||
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($this->collection as $limit) {
|
||||
@@ -113,9 +113,10 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
private function collectNotes(): void
|
||||
{
|
||||
$notes = Note::query()->whereIn('noteable_id', $this->ids)
|
||||
->whereNotNull('notes.text')
|
||||
->where('notes.text', '!=', '')
|
||||
->where('noteable_type', BudgetLimit::class)->get(['notes.noteable_id', 'notes.text'])->toArray();
|
||||
->whereNotNull('notes.text')
|
||||
->where('notes.text', '!=', '')
|
||||
->where('noteable_type', BudgetLimit::class)->get(['notes.noteable_id', 'notes.text'])->toArray()
|
||||
;
|
||||
foreach ($notes as $note) {
|
||||
$this->notes[(int)$note['noteable_id']] = (string)$note['text'];
|
||||
}
|
||||
@@ -144,12 +145,12 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
|
||||
private function collectBudgets(): void
|
||||
{
|
||||
$budgetIds = $this->collection->pluck('budget_id')->unique()->toArray();
|
||||
$budgets = Budget::whereIn('id', $budgetIds)->get();
|
||||
$budgetIds = $this->collection->pluck('budget_id')->unique()->toArray();
|
||||
$budgets = Budget::whereIn('id', $budgetIds)->get();
|
||||
|
||||
$repository = app(OperationsRepository::class);
|
||||
$repository->setUser($this->user);
|
||||
$expenses = $repository->collectExpenses($this->start, $this->end, null, $budgets, null);
|
||||
$expenses = $repository->collectExpenses($this->start, $this->end, null, $budgets, null);
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($this->collection as $budgetLimit) {
|
||||
@@ -180,13 +181,13 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
|
||||
private function stringifyIds(): void
|
||||
{
|
||||
$this->expenses = array_map(fn($first) => array_map(function ($second) {
|
||||
$this->expenses = array_map(fn ($first) => array_map(function ($second) {
|
||||
$second['currency_id'] = (string)($second['currency_id'] ?? 0);
|
||||
|
||||
return $second;
|
||||
}, $first), $this->expenses);
|
||||
|
||||
$this->pcExpenses = array_map(fn($first) => array_map(function ($second) {
|
||||
$this->pcExpenses = array_map(fn ($first) => array_map(function ($second) {
|
||||
$second['currency_id'] = (string)($second['currency_id'] ?? 0);
|
||||
|
||||
return $second;
|
||||
@@ -195,8 +196,9 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
|
||||
private function filterToBudget(array $expenses, int $budget): array
|
||||
{
|
||||
$result = array_filter($expenses, fn(array $item) => (int)$item['budget_id'] === $budget);
|
||||
$result = array_filter($expenses, fn (array $item) => (int)$item['budget_id'] === $budget);
|
||||
Log::debug(sprintf('filterToBudget for budget #%d, from %d to %d items', $budget, count($expenses), count($result)));
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user