add time limit to exams
This commit is contained in:
+10
-6
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user