Skip to content

Firefly III: a personal finances manager

Fix https://github.com/firefly-iii/firefly-iii/issues/12828

James Cole569f64279aa7
diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php
index 9b9aec606b..531368b054 100644
--- a/app/Http/Controllers/Report/TagController.php
+++ b/app/Http/Controllers/Report/TagController.php
@@ -264,13 +264,14 @@ final class TagController extends Controller
}
}
}
+ $incomeTopLength = count($result);
// sort by amount_float
// sort temp array by amount.
$amounts = array_column($result, 'avg_float');
array_multisort($amounts, SORT_ASC, $result);
try {
- $result = view('reports.tag.partials.avg-expenses', ['result' => $result])->render();
+ $result = view('reports.tag.partials.avg-expenses', ['incomeTopLength' => $incomeTopLength, 'result' => $result])->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
@@ -293,6 +294,7 @@ final class TagController extends Controller
foreach ($spent as $currency) {
foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) {
+
$sourceId = $journal['source_account_id'];
$key = sprintf('%d-%d', $sourceId, $currency['currency_id']);
$result[$key] ??= [
@@ -318,9 +320,9 @@ final class TagController extends Controller
// sort temp array by amount.
$amounts = array_column($result, 'avg_float');
array_multisort($amounts, SORT_DESC, $result);
-
+ $incomeTopLength = count($result);
try {
- $result = view('reports.tag.partials.avg-income', ['result' => $result])->render();
+ $result = view('reports.tag.partials.avg-income', ['result' => $result, 'incomeTopLength' => $incomeTopLength])->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
$result = sprintf('Could not render view: %s', $e->getMessage());
diff --git a/changelog.md b/changelog.md
index f231da76ea..78bb03ac11 100644
--- a/changelog.md
+++ b/changelog.md
@@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [Issue 12819](https://github.com/firefly-iii/firefly-iii/issues/12819) (Suscriptions with attachement in show page returns 500 error page) reported by @jsaneu
- #12822
- #12823
+- #12828
### Security