summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authoradityacp2020-08-28 08:24:54 +0530
committeradityacp2020-08-28 08:24:54 +0530
commitc77f0ca5616faa4e9426d610e38da1b6231346dc (patch)
tree72f41e5739a2b25cf15a4fa420236a3881cecc94 /yaksh/models.py
parent42dda2d828915f0f79dcdd816984489238661ebd (diff)
downloadonline_test-c77f0ca5616faa4e9426d610e38da1b6231346dc.tar.gz
online_test-c77f0ca5616faa4e9426d610e38da1b6231346dc.tar.bz2
online_test-c77f0ca5616faa4e9426d610e38da1b6231346dc.zip
Multiple changes
- Fix a bug where user cannot submit zero as answer - Fix UI in question statistics - Fix a bug where the trial question paper was not updated
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 6542daa..32632dd 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1695,17 +1695,15 @@ class QuestionPaperManager(models.Manager):
def create_trial_paper_to_test_quiz(self, trial_quiz, original_quiz_id):
"""Creates a trial question paper to test quiz."""
- if self.filter(quiz=trial_quiz).exists():
- trial_questionpaper = self.get(quiz=trial_quiz)
- else:
- trial_questionpaper, trial_questions = \
- self._create_trial_from_questionpaper(original_quiz_id)
- trial_questionpaper.quiz = trial_quiz
- trial_questionpaper.fixed_questions\
- .add(*trial_questions["fixed_questions"])
- trial_questionpaper.random_questions\
- .add(*trial_questions["random_questions"])
- trial_questionpaper.save()
+ trial_quiz.questionpaper_set.all().delete()
+ trial_questionpaper, trial_questions = \
+ self._create_trial_from_questionpaper(original_quiz_id)
+ trial_questionpaper.quiz = trial_quiz
+ trial_questionpaper.fixed_questions\
+ .add(*trial_questions["fixed_questions"])
+ trial_questionpaper.random_questions\
+ .add(*trial_questions["random_questions"])
+ trial_questionpaper.save()
return trial_questionpaper