From bc2866280b7a848825fea9c6b21e41273595e9e9 Mon Sep 17 00:00:00 2001 From: Dmitry Belan Date: Mon, 28 Sep 2026 21:15:54 +0300 Subject: [PATCH] Show correct answer for incorrect submissions --- .../lms/templates/lms/assignment_detail.html | 23 +++++++++++++++++++ lmsege/lms/templatetags/lms_tags.py | 7 ++++++ 2 files changed, 30 insertions(+) diff --git a/lmsege/lms/templates/lms/assignment_detail.html b/lmsege/lms/templates/lms/assignment_detail.html index f1d0d87..af42628 100644 --- a/lmsege/lms/templates/lms/assignment_detail.html +++ b/lmsege/lms/templates/lms/assignment_detail.html @@ -134,6 +134,29 @@ {{ answer.comment }} {% endif %} + + {% if answer.is_correct == False and answer.question.correct_answer %} +
+ Правильный ответ +
+ {% if answer.question.question_type == 'TABLE_AUTO' %} +
+ + {% for row in answer.question.correct_answer|parse_table_correct_answer %} + + {% for col in row %} + + {% endfor %} + + {% endfor %} +
{{ col }}
+
+ {% else %} + {{ answer.question.correct_answer }} + {% endif %} +
+
+ {% endif %} {% endfor %} diff --git a/lmsege/lms/templatetags/lms_tags.py b/lmsege/lms/templatetags/lms_tags.py index ff485b1..d119fed 100644 --- a/lmsege/lms/templatetags/lms_tags.py +++ b/lmsege/lms/templatetags/lms_tags.py @@ -14,3 +14,10 @@ def parse_json(value): return json.loads(value) except (ValueError, TypeError): return None + +@register.filter +def parse_table_correct_answer(value): + if not value: + return [] + rows = value.split(';') + return [row.split('|') for row in rows]