polish: document team-filter Salary scoping; stricter report regression assertion

This commit is contained in:
Konrad du Plessis 2026-05-15 20:52:30 +02:00
parent 65b10e74ec
commit d6f12e7dd1
2 changed files with 8 additions and 2 deletions

View File

@ -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(

View File

@ -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')