Skip to content

Commit 3c1b184

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c81edf3 commit 3c1b184

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

weblate_web/crm/views.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import calendar
44
import math
5-
from collections.abc import Callable
65
from decimal import Decimal
76
from operator import attrgetter
87
from typing import TYPE_CHECKING, cast
@@ -27,6 +26,8 @@
2726
from .models import Interaction
2827

2928
if TYPE_CHECKING:
29+
from collections.abc import Callable
30+
3031
from django.http import HttpRequest
3132

3233
from weblate_web.payments.models import CustomerQuerySet
@@ -367,9 +368,7 @@ def get_title(self) -> str:
367368
return f"Income Tracking - {year}/{month:02d}"
368369
return f"Income Tracking - {year}"
369370

370-
def generate_svg_pie_chart(
371-
self, data: dict[InvoiceCategory, Decimal]
372-
) -> str: # noqa: PLR0914
371+
def generate_svg_pie_chart(self, data: dict[InvoiceCategory, Decimal]) -> str:
373372
"""Generate a simple SVG pie chart for category distribution with legend."""
374373
if not data or sum(data.values()) == 0:
375374
return ""
@@ -602,6 +601,7 @@ def _aggregate_income_by_period(
602601
603602
Returns:
604603
Tuple of (period_totals_dict, invoices_list)
604+
605605
"""
606606
invoices, invoice_totals = self._get_invoices_and_totals(year, month)
607607

@@ -639,14 +639,18 @@ def get_income_data(
639639

640640
def get_monthly_data(self, year: int) -> tuple[dict[str, Decimal], list]:
641641
"""Get monthly income data for the year."""
642+
642643
def filter_by_month(inv: object, key: str) -> bool:
643644
return inv.issue_date.month == int(key)
644645

645646
monthly_keys = [f"{month:02d}" for month in range(1, 13)]
646-
return self._aggregate_income_by_period(year, None, filter_by_month, monthly_keys)
647+
return self._aggregate_income_by_period(
648+
year, None, filter_by_month, monthly_keys
649+
)
647650

648651
def get_daily_data(self, year: int, month: int) -> tuple[dict[str, Decimal], list]:
649652
"""Get daily income data for a specific month."""
653+
650654
def filter_by_day(inv: object, key: str) -> bool:
651655
return inv.issue_date.day == int(key)
652656

@@ -694,7 +698,7 @@ def get_context_data(self, **kwargs):
694698

695699
# Get income data (returns dict with InvoiceCategory keys)
696700
income_data = self.get_income_data(year, month)
697-
701+
698702
# Convert to label-keyed dict for template display
699703
income_data_labels = {cat.label: amount for cat, amount in income_data.items()}
700704
context["income_data"] = income_data_labels

0 commit comments

Comments
 (0)