diff options
author | Palaparthy Adityachandra | 2020-08-28 11:39:45 +0530 |
---|---|---|
committer | GitHub | 2020-08-28 11:39:45 +0530 |
commit | 052ac313e9f38e43cf16a3ae1f7f77cc58802529 (patch) | |
tree | a5a6bfd8bbdbdb358c8a8912261ab4e7407606c0 /yaksh/models.py | |
parent | 574e92a8586d4fc900be2c0d8f5114c93e826358 (diff) | |
parent | e3c3a0d9f7819f851890ea2611ba12b4f6255f06 (diff) | |
download | online_test-052ac313e9f38e43cf16a3ae1f7f77cc58802529.tar.gz online_test-052ac313e9f38e43cf16a3ae1f7f77cc58802529.tar.bz2 online_test-052ac313e9f38e43cf16a3ae1f7f77cc58802529.zip |
Merge pull request #748 from adityacp/multiple_fixes
Multiple changes
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index d3d90c9..1094bb0 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 |