add time limit to exams

This commit is contained in:
Ross
2020-12-28 10:18:34 +00:00
parent 0b09d1d4cc
commit a1f73afec5
3 changed files with 31 additions and 6 deletions
+10 -6
View File
@@ -181,7 +181,9 @@ class AnatomyQuestion(models.Model):
if i.status != i.MarkOptions.UNMARKED
]
)
correct_answers = set([i.answer.get_compare_string() for i in self.answers.all()])
correct_answers = set(
[i.answer.get_compare_string() for i in self.answers.all()]
)
half_mark_answers = set(
[i.answer.get_compare_string() for i in self.half_mark_answers.all()]
)
@@ -266,6 +268,10 @@ class Exam(models.Model):
help_text="If the json cache needs updating", default=False
)
time_limit = models.IntegerField(
help_text="Exam time limit (in seconds)", default=False
)
def __str__(self):
return self.name
@@ -366,11 +372,9 @@ class CidUserAnswer(models.Model):
is not None
):
mark = 1
elif (
q.answers.filter(
answer__iexact=ans, status=Answer.MarkOptions.INCORRECT
).first()
):
elif q.answers.filter(
answer__iexact=ans, status=Answer.MarkOptions.INCORRECT
).first():
mark = 0
else:
mark = "unmarked"