feat(reports): support multi-user chart series
This commit is contained in:
@@ -100,6 +100,28 @@ class ReportViewTests(APITestCase):
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.data["summary"]["total_duration"], "01:00:00")
|
||||
self.assertEqual(len(response.data["series"]), 1)
|
||||
self.assertEqual(response.data["series"][0]["user"]["id"], str(self.member.id))
|
||||
|
||||
def test_admin_chart_without_user_filter_returns_series_for_all_users(self):
|
||||
self.client.force_authenticate(user=self.admin)
|
||||
|
||||
with patch(
|
||||
"apps.reports.services.aggregation.timezone.localdate",
|
||||
return_value=date(2026, 4, 20),
|
||||
):
|
||||
response = self.client.get(
|
||||
"/api/reports/chart/",
|
||||
{"workspace": str(self.workspace.id), "period": "this_month"},
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.data["summary"]["total_duration"], "03:00:00")
|
||||
self.assertEqual(len(response.data["series"]), 2)
|
||||
self.assertEqual(
|
||||
{series["user"]["id"] for series in response.data["series"]},
|
||||
{str(self.owner.id), str(self.member.id)},
|
||||
)
|
||||
|
||||
def test_admin_can_request_combined_table_report(self):
|
||||
self.client.force_authenticate(user=self.admin)
|
||||
|
||||
Reference in New Issue
Block a user