From daebdc1844bd9242d635cf95c5df0b30a2da76d0 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 6 Jul 2026 09:29:15 +0100 Subject: [PATCH] feat: add exam mode URL handling and update user scores template --- generic/models.py | 3 +++ generic/widgets.py | 2 +- templates/user_scores.html | 2 +- todo | 11 ++++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/generic/models.py b/generic/models.py index b1c80466..3e0e1ad2 100644 --- a/generic/models.py +++ b/generic/models.py @@ -1149,6 +1149,9 @@ class ExamBase(ExamOrCollectionGenericBase): def get_take_url(self): return f"{settings.REMOTE_URL}/rts" + def get_take_url_exam_mode(self): + return f"{settings.REMOTE_URL}/rts?exam_mode=true" + def get_exam_name(self): return str(self) diff --git a/generic/widgets.py b/generic/widgets.py index d9ca3bfe..020696fe 100644 --- a/generic/widgets.py +++ b/generic/widgets.py @@ -66,7 +66,7 @@ class UserSearchSelectMultipleWidget: f'{u.get_full_name() or u.username} {u.email}' ) if grade_text: - selected_html += f' {grade_text}' + selected_html += f' {grade_text}' selected_html += ( '' f'' diff --git a/templates/user_scores.html b/templates/user_scores.html index 818498c5..fddd69f6 100644 --- a/templates/user_scores.html +++ b/templates/user_scores.html @@ -55,7 +55,7 @@
{% if exam.active %} - + {% endif %} diff --git a/todo b/todo index fa867a17..1c5a666c 100644 --- a/todo +++ b/todo @@ -1 +1,10 @@ -User answer compaction should only be available to admin users and on an exam wide basis. \ No newline at end of file +User answer compaction should only be available to admin users and on an exam wide basis. + +We need to update tests so that they can handle the new format of answer submission from rts: res = client.post(reverse("global_exam_answers_submit"), data=post_json) + json_res = json.loads(res.content) + assert json_res["success"] == False +> assert json_res["error"] == "Invalid data" +E AssertionError: assert 'user / cid mismatch' == 'Invalid data' +E +E - Invalid data +E + user / cid mismatch