.
This commit is contained in:
@@ -386,6 +386,9 @@ class CidUserAnswer(models.Model):
|
||||
question = models.ForeignKey(
|
||||
Rapid, related_name="cid_user_answers", on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
# For rapids the answer can be normal in which case the below field is true
|
||||
normal = models.BooleanField(default=False)
|
||||
answer = models.TextField(max_length=500, blank=True)
|
||||
|
||||
answer_compare = models.TextField(max_length=500, blank=True)
|
||||
@@ -430,6 +433,13 @@ class CidUserAnswer(models.Model):
|
||||
|
||||
def get_answer_score(self):
|
||||
q = self.question
|
||||
|
||||
# First step we check that the normal/abnormal states match
|
||||
if q.normal != self.normal:
|
||||
# If they don't match the answer is wrong (score is 0)
|
||||
return 0
|
||||
|
||||
# Then compare answer strings (as per anatomy questions)
|
||||
ans = self.answer_compare
|
||||
if (
|
||||
q.answers.filter(
|
||||
|
||||
Reference in New Issue
Block a user