diff options
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 8297ec8..dc08307 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -2235,7 +2235,14 @@ class AnswerPaper(models.Model): return questions def set_extra_time(self, time=0): - self.extra_time = time + now = timezone.now() + self.extra_time += time + if self.status == 'completed' and self.end_time < now: + self.extra_time = time + quiz_time = self.question_paper.quiz.duration + self.start_time = now - timezone.timedelta(minutes=quiz_time) + self.end_time = now + timezone.timedelta(minutes=time) + self.status = 'inprogress' self.save() def time_left(self): |