diff options
author | prathamesh | 2020-09-17 14:39:13 +0530 |
---|---|---|
committer | prathamesh | 2020-09-17 14:44:26 +0530 |
commit | 36440a47e148899058bb02216b73bfe17ee46d34 (patch) | |
tree | 374cb45c65d5bf5c2482afc3d5ccecfa4fb28644 /yaksh/models.py | |
parent | c9d0d238cd201310e5e6da546f518675f7a12440 (diff) | |
download | online_test-36440a47e148899058bb02216b73bfe17ee46d34.tar.gz online_test-36440a47e148899058bb02216b73bfe17ee46d34.tar.bz2 online_test-36440a47e148899058bb02216b73bfe17ee46d34.zip |
Allow to extend time even if the paper is completed.
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): |