diff --git a/.gitignore b/.gitignore index 5eb128d8..3c4e6529 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,6 @@ coverage.xml .hypothesis/ # Translations -*.mo *.pot # Django stuff: diff --git a/client/src/utils/export.ts b/client/src/utils/export.ts new file mode 100644 index 00000000..17f0e1c6 --- /dev/null +++ b/client/src/utils/export.ts @@ -0,0 +1,4 @@ +/** + * Created by christiancueni on 17.06.2024. + * Copyright (c) 2024 ITerativ GmbH. All rights reserved. + */ diff --git a/server/vbv_lernwelt/dashboard/tests/test_views.py b/server/vbv_lernwelt/dashboard/tests/test_views.py index a556b809..c98d5ae1 100644 --- a/server/vbv_lernwelt/dashboard/tests/test_views.py +++ b/server/vbv_lernwelt/dashboard/tests/test_views.py @@ -453,17 +453,15 @@ class ExportXlsTestCase(TestCase): # supervisor sees all cs in region supervisor = User.objects.get(id=TEST_SUPERVISOR1_USER_ID) requested_cs_ids = [ - str(TEST_COURSE_SESSION_ZURICH_ID), - str(TEST_COURSE_SESSION_BERN_ID), + TEST_COURSE_SESSION_ZURICH_ID, + TEST_COURSE_SESSION_BERN_ID, ] allowed_csrs_ids = _get_course_sessions_with_roles_for_user( supervisor, self.ALLOWED_ROLES, requested_cs_ids ) - self.assertCountEqual( - [int(cs) for cs in requested_cs_ids], [csr.id for csr in allowed_csrs_ids] - ) + self.assertCountEqual(requested_cs_ids, [csr.id for csr in allowed_csrs_ids]) def test_student_cannot_export_data(self): # student cannot export any data @@ -479,8 +477,8 @@ class ExportXlsTestCase(TestCase): # trainer can only export cs where she is assigned trainer = User.objects.get(email="test-trainer2@example.com") requested_cs_ids = [ - str(TEST_COURSE_SESSION_BERN_ID), - str(TEST_COURSE_SESSION_ZURICH_ID), + TEST_COURSE_SESSION_BERN_ID, + TEST_COURSE_SESSION_ZURICH_ID, ] allowed_csrs_ids = _get_course_sessions_with_roles_for_user( @@ -494,7 +492,7 @@ class ExportXlsTestCase(TestCase): def test_trainer_can_get_circles_where_expert(self): trainer = User.objects.get(email="test-trainer2@example.com") circle = Circle.objects.get(slug="test-lehrgang-lp-circle-fahrzeug") - requested_cs_ids = [str(TEST_COURSE_SESSION_ZURICH_ID)] + requested_cs_ids = [TEST_COURSE_SESSION_ZURICH_ID] allowed_csrs_ids = _get_course_sessions_with_roles_for_user( trainer, self.ALLOWED_ROLES, requested_cs_ids @@ -510,7 +508,7 @@ class ExportXlsTestCase(TestCase): def test_trainer_cannot_get_circles_where_not_expert(self): trainer = User.objects.get(email="test-trainer2@example.com") circle = Circle.objects.get(slug="test-lehrgang-lp-circle-reisen") - requested_cs_ids = [str(TEST_COURSE_SESSION_ZURICH_ID)] + requested_cs_ids = [TEST_COURSE_SESSION_ZURICH_ID] allowed_csrs_ids = _get_course_sessions_with_roles_for_user( trainer, self.ALLOWED_ROLES, requested_cs_ids @@ -525,7 +523,7 @@ class ExportXlsTestCase(TestCase): supervisor = User.objects.get(id=TEST_SUPERVISOR1_USER_ID) circle_reisen = Circle.objects.get(slug="test-lehrgang-lp-circle-reisen") circle_fahrzeug = Circle.objects.get(slug="test-lehrgang-lp-circle-fahrzeug") - requested_cs_ids = [str(TEST_COURSE_SESSION_ZURICH_ID)] + requested_cs_ids = [TEST_COURSE_SESSION_ZURICH_ID] allowed_csrs_ids = _get_course_sessions_with_roles_for_user( supervisor, self.ALLOWED_ROLES, requested_cs_ids diff --git a/server/vbv_lernwelt/dashboard/views.py b/server/vbv_lernwelt/dashboard/views.py index 41000109..05723e34 100644 --- a/server/vbv_lernwelt/dashboard/views.py +++ b/server/vbv_lernwelt/dashboard/views.py @@ -548,7 +548,7 @@ def export_attendance_as_xsl(request): ) data = export_attendance( [cs.id for cs in course_sessions_with_roles], - circle_ids=[int(circle_id) for circle_id in circle_ids], + circle_ids=circle_ids, ) return _make_excel_response(data) @@ -562,7 +562,7 @@ def export_competence_certificate_as_xsl(request): ) data = export_competence_certificates( [cswr.id for cswr in course_sessions_with_roles], - circle_ids=[int(circle_id) for circle_id in circle_ids], + circle_ids=circle_ids, ) return _make_excel_response(data) @@ -613,7 +613,7 @@ def _get_course_sessions_with_roles_for_user( csr for csr in get_course_sessions_with_roles_for_user(user) if any(role in allowed_roles for role in csr.roles) - and str(csr.id) in requested_cs_ids + and csr.id in requested_cs_ids ] # noqa return all_cs_roles_for_user