diff options
-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> |