diff options
author | mahesh | 2018-02-16 16:30:55 +0530 |
---|---|---|
committer | maheshgudi | 2018-03-16 15:17:20 +0530 |
commit | 140b6c6a06269cc39eae192605f623c7818e9260 (patch) | |
tree | 23cb79c0dd0931120cf0959e35534fad8118e321 /yaksh/models.py | |
parent | 366f9adce899b4cfd1e7a0e9a74dd5602fb0345a (diff) | |
download | online_test-140b6c6a06269cc39eae192605f623c7818e9260.tar.gz online_test-140b6c6a06269cc39eae192605f623c7818e9260.tar.bz2 online_test-140b6c6a06269cc39eae192605f623c7818e9260.zip |
Add shuffle_testcases to QuestionPaper model instead of Question
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 0bb1e66..8e0bb4d 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -818,10 +818,6 @@ class Question(models.Model): #Solution for the question. solution = models.TextField(blank=True) - # Shuffle testcase order. - shuffle_testcases = models.BooleanField("Shuffle testcase for each user", - default=False - ) def consolidate_answer_data(self, user_answer, user=None): question_data = {} @@ -1151,6 +1147,11 @@ class QuestionPaper(models.Model): # Sequence or Order of fixed questions fixed_question_order = models.CharField(max_length=255, blank=True) + # Shuffle testcase order. + shuffle_testcases = models.BooleanField("Shuffle testcase for each user", + default=True + ) + objects = QuestionPaperManager() def get_question_bank(self): @@ -1218,7 +1219,8 @@ class QuestionPaper(models.Model): for question in questions: question_ids.append(str(question.id)) testcases = question.get_test_cases() - if question.shuffle_testcases: + if self.shuffle_testcases and \ + question.type in ["mcq", "mcc"]: random.shuffle(testcases) testcases_ids = ",".join([str(tc.id) for tc in testcases]) testcases_order = TestCaseOrder.objects.create( |