This commit is contained in:
Ross
2021-12-15 19:48:08 +00:00
parent c7311fe1f5
commit f6282193af
12 changed files with 76 additions and 33 deletions
+11 -1
View File
@@ -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