diff options
author | mahesh | 2018-02-20 12:41:59 +0530 |
---|---|---|
committer | maheshgudi | 2018-03-16 15:15:50 +0530 |
commit | 21181922ee2b4d69fa62ae9725fcda759b475b80 (patch) | |
tree | 31bcd3d4a8eec287b201ab69893be908bea5db4e | |
parent | f531b9ca9c088263a53aff8574e93b74945b468f (diff) | |
download | online_test-21181922ee2b4d69fa62ae9725fcda759b475b80.tar.gz online_test-21181922ee2b4d69fa62ae9725fcda759b475b80.tar.bz2 online_test-21181922ee2b4d69fa62ae9725fcda759b475b80.zip |
TestCaseOrder created only mcc/mcq questions
-rw-r--r-- | yaksh/models.py | 8 | ||||
-rw-r--r-- | yaksh/templates/yaksh/user_data.html | 3 |
2 files changed, 6 insertions, 5 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) diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index 45867d2..ce2533e 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -74,8 +74,7 @@ User IP address: {{ paper.user_ip }} {% endif %} {% endfor %} - {% elif question.type == "integer" or question.type == "string" - or question.type == "float" %} + {% elif question.type == "integer" or question.type == "string" or question.type == "float" %} <h5> <u>Correct Answer:</u></h5> {% for testcase in question.get_test_cases %} <strong>{{ testcase.correct|safe }}</strong> |