Skip to content

Commit 7e0ce97

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 54e9514 commit 7e0ce97

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

weblate_web/crm/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
)
1616
from weblate_web.models import Package, PackageCategory, Service
1717
from weblate_web.payments.models import Customer, Payment
18-
from weblate_web.tests import RATES_JSON, cnb_mock_rates
18+
from weblate_web.tests import cnb_mock_rates
1919

2020

2121
class CRMTestCase(TestCase):
@@ -224,7 +224,7 @@ def create_test_invoice(self, year, month, category, amount):
224224
"""Create a test invoice with the specified parameters."""
225225
# Mock exchange rates
226226
cnb_mock_rates()
227-
227+
228228
invoice = Invoice.objects.create(
229229
kind=InvoiceKind.INVOICE,
230230
category=category,

weblate_web/crm/views.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,9 @@ def generate_svg_pie_chart(self, data: dict[str, Decimal]) -> str: # noqa: PLR0
465465
def generate_svg_stacked_bar_chart( # noqa: PLR0914
466466
self, monthly_data: dict, invoices: list, year: int, month: int | None = None
467467
) -> str:
468-
"""Generate a stacked bar chart showing totals by category.
469-
468+
"""
469+
Generate a stacked bar chart showing totals by category.
470+
470471
For yearly view (month=None): shows 12 monthly bars
471472
For monthly view (month=int): shows daily bars for that month
472473
"""
@@ -515,9 +516,7 @@ def generate_svg_stacked_bar_chart( # noqa: PLR0914
515516
x: float = padding + bar_spacing * (idx + 0.5)
516517

517518
# Get invoices for this time period by category
518-
period_invoices = [
519-
inv for inv in invoices if filter_func(inv, idx)
520-
]
519+
period_invoices = [inv for inv in invoices if filter_func(inv, idx)]
521520

522521
# Stack bars by category
523522
y_offset: float = height - padding
@@ -535,7 +534,9 @@ def generate_svg_stacked_bar_chart( # noqa: PLR0914
535534
bar_height = float(category_total / max_value * chart_height)
536535
y = y_offset - bar_height
537536

538-
title_label = f"{label_prefix} {bar_label}" if label_prefix else bar_label
537+
title_label = (
538+
f"{label_prefix} {bar_label}" if label_prefix else bar_label
539+
)
539540
svg_parts.append(
540541
f'<rect x="{x}" y="{y}" width="{bar_width}" height="{bar_height}" '
541542
f'fill="{self.CATEGORY_COLORS.get(category.label, "#999")}" stroke="white" stroke-width="1">'
@@ -547,7 +548,9 @@ def generate_svg_stacked_bar_chart( # noqa: PLR0914
547548
# Bar label
548549
label_x = x + bar_width / 2
549550
label_y = height - padding + 15
550-
font_size = "9" if month else "10" # Smaller font for daily view (more bars)
551+
font_size = (
552+
"9" if month else "10"
553+
) # Smaller font for daily view (more bars)
551554
svg_parts.append(
552555
f'<text x="{label_x}" y="{label_y}" text-anchor="middle" '
553556
f'font-size="{font_size}" fill="#666">{bar_label}</text>'

0 commit comments

Comments
 (0)