.
This commit is contained in:
@@ -21,19 +21,19 @@
|
||||
Unmarked:
|
||||
<ul id="new-answer-list" class="answer-list">
|
||||
{% for answer in user_answers %}
|
||||
<li><pre><span class="answer not-marked" title="{{answer}}">{{ answer }}</span></pre></li>
|
||||
<li><pre><span class="answer not-marked" title="{{answer}}" data-answerurl="{% url 'anatomy:question_user_answers_by_compare' question.pk answer %}">{{ answer }}</span></pre></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
Marked:
|
||||
<ul id="marked-answer-list" class="answer-list">
|
||||
{% for answer in correct_answers %}
|
||||
<li><pre><span class="answer correct" title="{{answer}}">{{ answer }}</span></pre></li>
|
||||
<li><pre><span class="answer correct" title="{{answer}}" data-answerurl="{% url 'anatomy:question_user_answers_by_compare' question.pk answer %}">{{ answer }}</span></pre></li>
|
||||
{% endfor %}
|
||||
{% for answer in half_mark_answers %}
|
||||
<li><pre><span class="answer half-correct" title="{{answer}}">{{ answer }}</span></pre></li>
|
||||
<li><pre><span class="answer half-correct" title="{{answer}}" data-answerurl="{% url 'anatomy:question_user_answers_by_compare' question.pk answer %}">{{ answer }}</span></pre></li>
|
||||
{% endfor %}
|
||||
{% for answer in incorrect_answers %}
|
||||
<li><pre><span class="answer incorrect" title="{{answer}}">{{ answer }}</span></pre></li>
|
||||
<li><pre><span class="answer incorrect" title="{{answer}}" data-answerurl="{% url 'anatomy:question_user_answers_by_compare' question.pk answer %}">{{ answer }}</span></pre></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="mark-buttons">
|
||||
@@ -78,6 +78,7 @@
|
||||
<ul class="popovermenu">
|
||||
<li><a href="https://www.google.com/search?q=${uri}" target="_blank">Google answer</a></li>
|
||||
<span class="copy-to-clipboard" data-text="${el.title}">Copy to clipboard</span>
|
||||
<li><a href="${el.dataset.answerurl}" target="_blank">view answers</a></li>
|
||||
</ul>
|
||||
</div>`)
|
||||
$(el).before(popover)
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
{% extends 'anatomy/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{{question}}</h2>
|
||||
|
||||
{% if answer_compare %}
|
||||
Filtering by answer: {{answer_compare}} <a href="{% url 'anatomy:question_user_answers' question.pk %}">[view all]</a>
|
||||
{% endif %}
|
||||
|
||||
<ul>
|
||||
{% for answer in answers %}
|
||||
<li><a href="{% url 'anatomy:user_answer_view' pk=answer.pk %}">{{answer}} [score: {{answer.score}}]</a></li>
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
||||
}
|
||||
|
||||
try:
|
||||
question = questions[sk]
|
||||
question: AnatomyQuestion = questions[sk]
|
||||
except IndexError:
|
||||
raise Http404("Exam question does not exist")
|
||||
|
||||
|
||||
+7
-2
@@ -2,7 +2,7 @@ from django.urls import path, include
|
||||
|
||||
from generic.models import Examination
|
||||
from . import views
|
||||
from generic.views import ExamViews as GenericExamViews
|
||||
from generic.views import ExamViews as GenericExamViews, GenericViewBase
|
||||
|
||||
|
||||
app_name = "generic"
|
||||
@@ -147,7 +147,7 @@ urlpatterns = [
|
||||
]
|
||||
|
||||
|
||||
def generic_view_urls(generic_views):
|
||||
def generic_view_urls(generic_views: GenericViewBase):
|
||||
urlpatterns = [
|
||||
path(
|
||||
"user_answers/delete",
|
||||
@@ -164,6 +164,11 @@ def generic_view_urls(generic_views):
|
||||
generic_views.question_user_answers,
|
||||
name="question_user_answers",
|
||||
),
|
||||
path(
|
||||
"question/<int:pk>/user_answers/<str:answer_compare>/str",
|
||||
generic_views.question_user_answers_by_compare,
|
||||
name="question_user_answers_by_compare",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/review",
|
||||
generic_views.question_review,
|
||||
|
||||
+14
-3
@@ -2322,16 +2322,27 @@ class GenericViewBase:
|
||||
{"question": question, "view_feedback": view_feedback},
|
||||
)
|
||||
|
||||
# TODO: improve permissions on these
|
||||
@method_decorator(login_required)
|
||||
def question_user_answers(self, request, pk):
|
||||
def question_user_answers_by_compare(self, request, pk, answer_compare):
|
||||
print(answer_compare)
|
||||
return self.question_user_answers(request, pk, answer_compare)
|
||||
|
||||
@method_decorator(login_required)
|
||||
def question_user_answers(self, request, pk, answer_compare=None):
|
||||
print(locals())
|
||||
question = get_object_or_404(self.question_object, pk=pk)
|
||||
|
||||
answers = self.cid_user_answer_object.objects.filter(question__id=question.pk).prefetch_related("question", "exam", "user")
|
||||
if answer_compare is None:
|
||||
answers = self.cid_user_answer_object.objects.filter(question__id=question.pk).prefetch_related("question", "exam", "user")
|
||||
else:
|
||||
answers = self.cid_user_answer_object.objects.filter(question__id=question.pk, answer_compare=answer_compare).prefetch_related("question", "exam", "user")
|
||||
|
||||
|
||||
return render(
|
||||
request,
|
||||
f"{self.app_name}/question_user_answers.html",
|
||||
{"question": question, "answers": answers},
|
||||
{"question": question, "answers": answers, "answer_compare": answer_compare},
|
||||
)
|
||||
|
||||
@method_decorator(login_required)
|
||||
|
||||
Reference in New Issue
Block a user