.
This commit is contained in:
+11
-1
@@ -685,7 +685,17 @@ class CidUserAnswer(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse("rapids:user_answer_view", kwargs={"pk": self.pk})
|
||||
|
||||
def get_answer_score(self):
|
||||
def get_answer_score(self, cached=True):
|
||||
if cached and self.score:
|
||||
if self.score == Answer.MarkOptions.CORRECT:
|
||||
mark = 2
|
||||
elif self.score == Answer.MarkOptions.HALF_MARK:
|
||||
mark = 1
|
||||
elif self.score == Answer.MarkOptions.INCORRECT:
|
||||
mark = 0
|
||||
|
||||
return mark
|
||||
|
||||
q = self.question
|
||||
|
||||
# First step we check that the normal/abnormal states match
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}
|
||||
Rapids
|
||||
Rapids
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
@@ -13,20 +13,23 @@ Rapids
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% if simple_content %}
|
||||
{{simple_content}}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block navigation %}
|
||||
Rapids:
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'rapids:index' %}">Packets</a> /
|
||||
<a href="{% url 'rapids:exam_list' %}">Exams</a> /
|
||||
<a href="{% url 'rapids:exam_create' %}" title="Create a new exam">Create Exam</a> /
|
||||
<a href="{% url 'rapids:rapid_view' %}">Questions</a> /
|
||||
<a href="{% url 'rapids:rapid_create' %}" title="Create a new question">Create Question</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
/ <a href="{% url 'rapids:user_answer_table_view' %}" title="User answers">Answers</a>
|
||||
{% endif %}
|
||||
{% comment %} </br>
|
||||
Rapids:
|
||||
{% if request.user.is_authenticated %}
|
||||
<a href="{% url 'rapids:index' %}">Packets</a> /
|
||||
<a href="{% url 'rapids:exam_list' %}">Exams</a> /
|
||||
<a href="{% url 'rapids:exam_create' %}" title="Create a new exam">Create Exam</a> /
|
||||
<a href="{% url 'rapids:rapid_view' %}">Questions</a> /
|
||||
<a href="{% url 'rapids:rapid_create' %}" title="Create a new question">Create Question</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
/ <a href="{% url 'rapids:user_answer_table_view' %}" title="User answers">Answers</a>
|
||||
{% endif %}
|
||||
{% comment %} </br>
|
||||
Questions by:
|
||||
<span id="authors-link"><a href="{% url 'rapids:author_list' %}">author</a></span> {% endcomment %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<div id="stats-plot">{{plot|safe}}</div>
|
||||
<div class="rapids">
|
||||
<h2>{{ exam.name }}</h2>
|
||||
User answer scores are cached, if you update or change an answer you will need to <a href="{% url 'anatomy:exam_scores_refresh' exam.pk %}">refresh the scores</a>.
|
||||
|
||||
{% if unmarked %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
|
||||
@@ -75,6 +75,12 @@ urlpatterns = [
|
||||
cache_page(60 * 1)(views.exam_scores_cid),
|
||||
name="exam_scores_cid",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/scores/refresh",
|
||||
views.RapidExamViews.exam_scores_refresh,
|
||||
# cache_page(60 * 1)(views.exam_scores_cid),
|
||||
name="exam_scores_refresh",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/scores/<int:cid>/<str:passcode>/",
|
||||
views.exam_scores_cid_user,
|
||||
|
||||
+1
-1
@@ -928,7 +928,7 @@ class QuestionDelete(AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
success_url = reverse_lazy("rapids:rapid_view")
|
||||
|
||||
|
||||
RapidExamViews = ExamViews(Exam, Rapid, "rapids", "rapid", loadJsonAnswer)
|
||||
RapidExamViews = ExamViews(Exam, Rapid, CidUserAnswer, "rapids", "rapid", loadJsonAnswer)
|
||||
|
||||
|
||||
class ExamCreate(RevisionMixin, LoginRequiredMixin, CreateView):
|
||||
|
||||
Reference in New Issue
Block a user