Add user answer viewing and compaction
This commit is contained in:
@@ -9,6 +9,7 @@ from rad.settings import REMOTE_URL
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
import dicognito
|
||||
import json
|
||||
import reversion
|
||||
|
||||
# Create your models here.
|
||||
from generic.models import (
|
||||
@@ -590,6 +591,7 @@ class Exam(ExamBase):
|
||||
return reverse("shorts:exam_overview", kwargs={"pk": self.pk})
|
||||
|
||||
|
||||
@reversion.register
|
||||
class UserAnswer(UserAnswerBase):
|
||||
"""User answers by candidate"""
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load help_tags %}
|
||||
|
||||
{% block content %}
|
||||
<div class="question-display-block card mb-4" style="background-color: #111; color: #fff;">
|
||||
@@ -24,6 +25,15 @@
|
||||
{% for ans, score, correct_answer, feedback in answers_and_marks %}
|
||||
<li class="user-answer-li" data-question-number="{{forloop.counter}}">Question {{forloop.counter}} - Correct answer: {% if exam.publish_results %}<span class="correct-answer">{{correct_answer}}</span>{% endif %}
|
||||
<span class="view-question-link" data-qn={{forloop.counter0}}>View</span>
|
||||
{% if request.user.is_staff or view_all_results or request.user in exam.author.all %}
|
||||
{% with q=questions|get_item:forloop.counter0 %}
|
||||
{% with ua=user_answers_map|get_item:q.pk %}
|
||||
{% if ua %}
|
||||
<a href="{% url 'generic:view_answer_history' app_name='shorts' model_name='UserAnswer' pk=ua.pk %}" class="btn btn-sm btn-outline-info ms-2" style="font-size: 11px; padding: 2px 6px; vertical-align: middle;">History</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
<br/>
|
||||
<span class="user-answer-score user-answer-score-{{score}}">
|
||||
<span class="submitted-user-answer">
|
||||
|
||||
Reference in New Issue
Block a user