summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authormahesh2018-02-20 12:41:59 +0530
committermaheshgudi2018-03-16 15:17:20 +0530
commit4a5463d753c9af41d85a6be33257012c17d2ab15 (patch)
tree31bcd3d4a8eec287b201ab69893be908bea5db4e /yaksh/models.py
parent140b6c6a06269cc39eae192605f623c7818e9260 (diff)
downloadonline_test-4a5463d753c9af41d85a6be33257012c17d2ab15.tar.gz
online_test-4a5463d753c9af41d85a6be33257012c17d2ab15.tar.bz2
online_test-4a5463d753c9af41d85a6be33257012c17d2ab15.zip
TestCaseOrder created only mcc/mcq questions
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 8e0bb4d..ecc0fc4 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1218,15 +1218,17 @@ class QuestionPaper(models.Model):
question_ids = []
for question in questions:
question_ids.append(str(question.id))
- testcases = question.get_test_cases()
if self.shuffle_testcases and \
question.type in ["mcq", "mcc"]:
+ testcases = question.get_test_cases()
random.shuffle(testcases)
- testcases_ids = ",".join([str(tc.id) for tc in testcases])
- testcases_order = TestCaseOrder.objects.create(
+ testcases_ids = ",".join([str(tc.id) for tc in testcases]
+ )
+ testcases_order = TestCaseOrder.objects.create(
answer_paper=ans_paper,
question=question,
order=testcases_ids)
+
ans_paper.questions_order = ",".join(question_ids)
ans_paper.save()
ans_paper.questions_unanswered.add(*questions)