summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py12
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(