diff options
author | prathamesh | 2017-11-07 13:05:05 +0530 |
---|---|---|
committer | prathamesh | 2017-11-07 13:05:05 +0530 |
commit | 4c1ddc15f3b9a15bee49ac2f6640c8ed311f7151 (patch) | |
tree | 2a6fe1538fc4b20d17cb156e04bb7bba4e217587 /yaksh | |
parent | b7864df91a82d6d56d4eb76d39aae2954302669a (diff) | |
download | online_test-4c1ddc15f3b9a15bee49ac2f6640c8ed311f7151.tar.gz online_test-4c1ddc15f3b9a15bee49ac2f6640c8ed311f7151.tar.bz2 online_test-4c1ddc15f3b9a15bee49ac2f6640c8ed311f7151.zip |
Made changes as per suggestions
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/test_models.py | 14 | ||||
-rw-r--r-- | yaksh/views.py | 13 |
2 files changed, 15 insertions, 12 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index ee698a6..ddacb2a 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -388,15 +388,15 @@ class QuestionPaperTestCases(unittest.TestCase): self.question_paper_fixed_questions = QuestionPaper.objects.create( quiz=self.quiz) self.question_paper_fixed_questions.fixed_questions.add( - self.questions.get(id=11), self.questions.get(id=10)) + self.questions.get(summary='Q11'), self.questions.get(summary='Q10')) # create question paper with only random questions self.question_paper_random_questions = QuestionPaper.objects.create( quiz=self.quiz) self.question_set_random = QuestionSet.objects.create(marks=2, num_questions=2) - self.question_set_random.questions.add(self.questions.get(id=13), - self.questions.get(id=5), self.questions.get(id=7)) + self.question_set_random.questions.add(self.questions.get(summary='Q13'), + self.questions.get(summary='Q5'), self.questions.get(summary='Q7')) self.question_paper_random_questions.random_questions.add( self.question_set_random) @@ -464,16 +464,16 @@ class QuestionPaperTestCases(unittest.TestCase): def test_get_question_bank(self): # Given - ids = [11, 10] - questions = list(Question.objects.filter(id__in=ids)) + summaries = ['Q11', 'Q10'] + questions = list(Question.objects.filter(summary__in=summaries)) # When question_bank = self.question_paper_fixed_questions.get_question_bank() # Then self.assertSequenceEqual(questions, question_bank) # Given - ids = [13, 5, 7] - questions = list(Question.objects.filter(id__in=ids)) + summaries = ['Q13','Q5','Q7'] + questions = list(Question.objects.filter(summary__in=summaries)) # When question_bank = self.question_paper_random_questions.get_question_bank() # Then diff --git a/yaksh/views.py b/yaksh/views.py index 0293ae7..3c57b83 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -80,6 +80,10 @@ def add_to_group(users): user.groups.add(group) +CSV_FIELDS = ['name', 'username', 'roll_number', 'institute', 'department', + 'questions', 'marks_obtained', 'out_of', 'percentage', 'status'] + + @email_verified def index(request, next_url=None): """The start page. @@ -1012,8 +1016,7 @@ def monitor(request, quiz_id=None): attempt_number=last_attempt['last_attempt_num'] ) ) - csv_fields = ['name', 'username', 'roll_number', 'institute', - 'department', 'questions', 'total', 'out_of', 'percentage', 'status'] + csv_fields = CSV_FIELDS context = { "papers": papers, "quiz": quiz, @@ -1302,8 +1305,7 @@ def download_quiz_csv(request, course_id, quiz_id): csv_fields = request.POST.getlist('csv_fields') attempt_number = request.POST.get('attempt_number', last_attempt_number) if not csv_fields: - csv_fields = ['name', 'username', 'roll_number', 'institute', - 'department', 'questions', 'total', 'out_of', 'percentage', 'status'] + csv_fields = CSV_FIELDS if not attempt_number: attempt_number = last_attempt_number @@ -1326,7 +1328,8 @@ def download_quiz_csv(request, course_id, quiz_id): 'roll_number': 'user.profile.roll_number', 'institute': 'user.profile.institute', 'department': 'user.profile.department', - 'username': 'user.username', 'total': 'answerpaper.marks_obtained', + 'username': 'user.username', + 'marks_obtained': 'answerpaper.marks_obtained', 'out_of': 'question_paper.total_marks', 'percentage': 'answerpaper.percent', 'status': 'answerpaper.status'} questions_scores = {} |