From d6f12e7dd102708521393c42c8130e8834e9440b Mon Sep 17 00:00:00 2001 From: Konrad du Plessis Date: Fri, 15 May 2026 20:52:30 +0200 Subject: [PATCH] polish: document team-filter Salary scoping; stricter report regression assertion --- core/tests.py | 4 ++-- core/views.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/tests.py b/core/tests.py index ba90088..f4f28fb 100644 --- a/core/tests.py +++ b/core/tests.py @@ -3676,8 +3676,8 @@ class ManagerSalariedPayReportTests(TestCase): # WorkLog-derived figures must be IDENTICAL with a manager present. self.assertEqual(before.get('total_worker_days'), after.get('total_worker_days')) - self.assertEqual(str(before.get('cost_per_project')), - str(after.get('cost_per_project'))) + self.assertEqual(before.get('cost_per_project'), + after.get('cost_per_project')) def test_salaried_cost_by_project_exposed(self): mgr = Worker.objects.create( diff --git a/core/views.py b/core/views.py index 87ee967..3e449ff 100644 --- a/core/views.py +++ b/core/views.py @@ -2525,6 +2525,12 @@ def _build_report_context(start_date, end_date, project_ids=None, team_ids=None) # the project filter via the safe FK `project_id__in` subquery — no M2M # JOIN inflation, per the CLAUDE.md "M2M filter + aggregate inflation" # note). We do NOT add a chained `.filter().filter()` here. + # + # Under a team filter the upstream `adjustments` queryset is already + # scoped to workers on the selected teams (exactly like every other + # adjustment figure on this report) — so a manager who isn't on a + # filtered team won't appear here. That's intended and consistent with + # the report's existing adjustment scoping. salaried_rows = ( adjustments.filter(type='Salary') .values('project__id', 'project__name')