Show correct answer for incorrect submissions
This commit is contained in:
@@ -134,6 +134,29 @@
|
|||||||
<span class="text-txt-secondary">{{ answer.comment }}</span>
|
<span class="text-txt-secondary">{{ answer.comment }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if answer.is_correct == False and answer.question.correct_answer %}
|
||||||
|
<div class="mt-3 p-3 text-sm bg-obsidian-card border border-rose-900/50 rounded-r-lg border-l-2 border-l-rose-500">
|
||||||
|
<span class="text-rose-400/90 text-xs font-mono uppercase block mb-1">Правильный ответ</span>
|
||||||
|
<div class="text-rose-100 font-medium">
|
||||||
|
{% if answer.question.question_type == 'TABLE_AUTO' %}
|
||||||
|
<div class="overflow-x-auto mt-2 mb-1">
|
||||||
|
<table class="w-full border-collapse border border-rose-900/50 text-sm text-left">
|
||||||
|
{% for row in answer.question.correct_answer|parse_table_correct_answer %}
|
||||||
|
<tr>
|
||||||
|
{% for col in row %}
|
||||||
|
<td class="border border-rose-900/50 p-2 text-rose-200 bg-rose-950/20">{{ col }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{{ answer.question.correct_answer }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -14,3 +14,10 @@ def parse_json(value):
|
|||||||
return json.loads(value)
|
return json.loads(value)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def parse_table_correct_answer(value):
|
||||||
|
if not value:
|
||||||
|
return []
|
||||||
|
rows = value.split(';')
|
||||||
|
return [row.split('|') for row in rows]
|
||||||
|
|||||||
Reference in New Issue
Block a user