From 5219ac015971924f08a8879181105cf711c8ac8f Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 4 Apr 2022 16:26:18 +0100 Subject: [PATCH] . --- .../templates/atlas/collection_case_view.html | 4 +-- atlas/views.py | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/atlas/templates/atlas/collection_case_view.html b/atlas/templates/atlas/collection_case_view.html index 9f9faa10..3b4df174 100644 --- a/atlas/templates/atlas/collection_case_view.html +++ b/atlas/templates/atlas/collection_case_view.html @@ -78,8 +78,8 @@ {% endif %} {% if collection.publish_results %} -

Score: {{answer.score}}

-

Feedback: {{answer.feedback|safe}}

+ Answer score: {{answer.score}}
+ Answer feedback: {{answer.feedback|safe}} {% endif %}
diff --git a/atlas/views.py b/atlas/views.py index 96b2020d..77570731 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -1289,21 +1289,22 @@ def collection_case_view(request, pk, case_number, take=False, cid=None, passcod answer = case_detail.cidreportanswer_set.filter(cid=cid).first() if request.method == "POST": - if answer: - form = CidReportAnswerForm(request.POST, instance=answer) - else: - form = CidReportAnswerForm(request.POST) - if form.is_valid(): - answer = form.save(commit=False) - answer.cid = cid - answer.question = case_detail - # answer.published_date = timezone.now() - answer.save() + if not collection.publish_results: + if answer: + form = CidReportAnswerForm(request.POST, instance=answer) + else: + form = CidReportAnswerForm(request.POST) + if form.is_valid(): + answer = form.save(commit=False) + answer.cid = cid + answer.question = case_detail + # answer.published_date = timezone.now() + answer.save() - cid_user_exam.end_time = timezone.now() - cid_user_exam.save() + cid_user_exam.end_time = timezone.now() + cid_user_exam.save() - kwargs = {"pk": pk, "cid": cid, "passcode": passcode} + kwargs = {"pk": pk, "cid": cid, "passcode": passcode} if "next" in request.POST: return redirect(