fix: align total costs with visible budgets

This commit is contained in:
2026-05-06 13:31:32 +02:00
parent 7cd85cc5ae
commit 3990a2ea49
5 changed files with 162 additions and 11 deletions
+17 -11
View File
@@ -190,7 +190,7 @@ class MonthService:
(
self.share_service.calculate_entry_shares(item)["internal_total"]
for item in month.entry_values
if item.entry_id not in distribution_entry_ids
if item.entry_id not in distribution_entry_ids and self._is_visible_monthly_value(item)
),
Decimal("0.00"),
)
@@ -368,19 +368,12 @@ class MonthService:
def _distribution_entry_values(self, month: Month) -> dict[str, MonthlyEntryValue]:
grouped: dict[str, list[MonthlyEntryValue]] = {}
for value in month.entry_values:
if not self._is_visible_monthly_value(value):
continue
entry = value.entry
category = entry.category if entry else None
account = category.account if category else None
if (
entry is None
or category is None
or account is None
or not entry.is_active
or not category.is_active
or not account.is_active
or account.slug not in self.allocation_service.TARGET_SLUGS
or not entry.is_allocation_target
):
if account is None or account.slug not in self.allocation_service.TARGET_SLUGS or not entry.is_allocation_target:
continue
grouped.setdefault(account.slug, []).append(value)
@@ -397,6 +390,19 @@ class MonthService:
preferred[account_slug] = values[0]
return preferred
def _is_visible_monthly_value(self, value: MonthlyEntryValue) -> bool:
entry = value.entry
category = entry.category if entry else None
account = category.account if category else None
return bool(
entry is not None
and category is not None
and account is not None
and entry.is_active
and category.is_active
and account.is_active
)
def _distribution_label(self, account_slug: str, fallback: str) -> str:
personal_labels = personal_account_names()
if account_slug in personal_labels: