diff options
author | adityacp | 2017-10-05 17:07:41 +0530 |
---|---|---|
committer | adityacp | 2017-10-06 12:44:34 +0530 |
commit | 474fc2c54eda0e8c890ea17b791b2fe74d07c611 (patch) | |
tree | 3fd3644d9af7c8b0cdf990a0aad00c00156d77c7 /yaksh/models.py | |
parent | 3038ab21bc93b3dfebda82a10fc179dadb488bf3 (diff) | |
download | online_test-474fc2c54eda0e8c890ea17b791b2fe74d07c611.tar.gz online_test-474fc2c54eda0e8c890ea17b791b2fe74d07c611.tar.bz2 online_test-474fc2c54eda0e8c890ea17b791b2fe74d07c611.zip |
Change models.py and test_models.py
- Add else condition in make_answerpaper instead of direct return
- Remove while loop in shuffle questions testcase
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 1cc0634..78669e7 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -853,8 +853,11 @@ class QuestionPaper(models.Model): for question_set in self.random_questions.all(): questions += question_set.get_random_questions() if self.shuffle_questions: - return self.get_shuffled_questions(questions) - return questions + all_questions = self.get_shuffled_questions(questions) + print("in _get_questions_for_answerpaper", all_questions, "\n") + else: + all_questions = questions + return all_questions def make_answerpaper(self, user, ip, attempt_num): """Creates an answer paper for the user to attempt the quiz""" @@ -950,6 +953,7 @@ class QuestionPaper(models.Model): def get_shuffled_questions(self, questions): """Get shuffled questions if auto suffle is enabled""" random.shuffle(questions) + print("in get_shuffled_questions", questions, "\n") return questions def __str__(self): |