From 80b690d6de08503621b3bc55b69a3bbcbf636556 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 19 Aug 2021 10:09:08 +0100 Subject: [PATCH] . --- anatomy/static/css/anatomy.css | 3 ++- rapids/models.py | 17 +++++++++++++++++ rapids/views.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/anatomy/static/css/anatomy.css b/anatomy/static/css/anatomy.css index a5678a2f..784dfb7a 100644 --- a/anatomy/static/css/anatomy.css +++ b/anatomy/static/css/anatomy.css @@ -208,7 +208,8 @@ button a { #full-question-list li::before{ counter-increment: question-list; - content: counter(question-list) ": "; + content: counter(question-list) " "; + padding-right: 0.5em; } #full-question-list img{ diff --git a/rapids/models.py b/rapids/models.py index 44670779..3d93a072 100644 --- a/rapids/models.py +++ b/rapids/models.py @@ -554,6 +554,23 @@ class CidUserAnswer(models.Model): # Then compare answer strings (as per anatomy questions) ans = self.answer_compare + + try: + marked_ans = q.answers.objects.get(answer_compare__iexact=ans) + except q.answers.DoesNotExist: + marked_ans = None + + mark = "unmarked" + if marked_ans is not None: + if marked_ans.status == Answer.MarkOptions.CORRECT: + mark = 1 + elif Answer.MarkOptions.HALF_MARK: + mark = 0.5 + elif Answer.MarkOptions.INCORRECT: + mark = 0 + + return mark + if ( q.answers.filter( answer_compare__iexact=ans, status=Answer.MarkOptions.CORRECT diff --git a/rapids/views.py b/rapids/views.py index 273e49fa..d71e4b8a 100755 --- a/rapids/views.py +++ b/rapids/views.py @@ -480,7 +480,7 @@ def rapid_scrap(request, pk): if ( not request.user.groups.filter(name="rapid_checker").exists() - and request.user not in question.author.all() + and request.user not in rapid.author.all() ): raise PermissionDenied()