Skip to content

Firefly III: a personal finances manager

Skip non-existing tags.

James Cole1e31a1184a07
diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php
index 3b8fb687bb..82b0d5461c 100644
--- a/app/Http/Controllers/Report/TagController.php
+++ b/app/Http/Controllers/Report/TagController.php
@@ -155,6 +155,7 @@ class TagController extends Controller
*/
public function accounts(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
+ $tagIds = $tags->pluck('id')->toArray();
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
$earned = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
$report = [];
@@ -184,6 +185,9 @@ class TagController extends Controller
'total_sum' => '0',
];
foreach ($currency['tags'] as $tag) {
+ if(!array_key_exists($tag['id'], $tagIds)) {
+ continue;
+ }
foreach ($tag['transaction_journals'] as $journal) {
$sourceAccountId = $journal['source_account_id'];
$report[$sourceAccountId]['currencies'][$currencyId] ??= [
@@ -222,6 +226,9 @@ class TagController extends Controller
'total_sum' => '0',
];
foreach ($currency['tags'] as $tag) {
+ if(!array_key_exists($tag['id'], $tagIds)) {
+ continue;
+ }
foreach ($tag['transaction_journals'] as $journal) {
$destinationAccountId = $journal['destination_account_id'];
$report[$destinationAccountId]['currencies'][$currencyId] ??= [
@@ -446,7 +453,6 @@ class TagController extends Controller
}
}
}
- Log::info('Temp report', $report);
return view('reports.tag.partials.tags', compact('sums', 'report'));
}