summaryrefslogtreecommitdiff
path: root/yaksh/test_views.py
diff options
context:
space:
mode:
authorprathamesh2017-10-26 14:35:08 +0530
committerprathamesh2017-10-26 14:35:08 +0530
commit1f554e7505f5a6aa1b796b2e31e1541188af56da (patch)
treecbe0f88b2dd7dd8ef37f391f89bb8f578cae40e0 /yaksh/test_views.py
parent97a277cf5b86f60525f94302d5b04de420ad7212 (diff)
downloadonline_test-1f554e7505f5a6aa1b796b2e31e1541188af56da.tar.gz
online_test-1f554e7505f5a6aa1b796b2e31e1541188af56da.tar.bz2
online_test-1f554e7505f5a6aa1b796b2e31e1541188af56da.zip
CSV download for quiz enhanced
CSV download for a quiz now shows question wise grades. Also, for a given attempt all the users from the course are entered in the CSV. If the user has not attempted then a dash '-' is put under the grades. Also, handles random questions, if a question paper has questions selected from pool of questions then all the questions are entered in the CSV. 'NA' is put under the question grade if that question has not come in the question/answer paper for that given user.
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r--yaksh/test_views.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index dc06126..af9ac7d 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -2904,6 +2904,7 @@ class TestDownloadcsv(TestCase):
self.mod_group.user_set.add(self.user)
self.course = Course.objects.create(name="Python Course",
enrollment="Enroll Request", creator=self.user)
+ self.course.students.add(self.student)
self.quiz = Quiz.objects.create(
start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone),
@@ -2956,8 +2957,9 @@ class TestDownloadcsv(TestCase):
username=self.student.username,
password=self.student_plaintext_pass
)
- response = self.client.get(reverse('yaksh:download_csv',
- kwargs={"questionpaper_id": self.question_paper.id}),
+ response = self.client.get(reverse('yaksh:download_quiz_csv',
+ kwargs={"course_id": self.course.id,
+ "quiz_id": self.quiz.id}),
follow=True
)
self.assertEqual(response.status_code, 404)
@@ -2985,8 +2987,9 @@ class TestDownloadcsv(TestCase):
username=self.student.username,
password=self.student_plaintext_pass
)
- response = self.client.get(reverse('yaksh:download_csv',
- kwargs={"questionpaper_id": self.question_paper.id}),
+ response = self.client.get(reverse('yaksh:download_quiz_csv',
+ kwargs={"course_id": self.course.id,
+ "quiz_id": self.quiz.id}),
follow=True
)
self.assertEqual(response.status_code, 404)
@@ -3031,11 +3034,14 @@ class TestDownloadcsv(TestCase):
username=self.user.username,
password=self.user_plaintext_pass
)
- response = self.client.get(reverse('yaksh:download_csv',
- kwargs={'questionpaper_id': self.question_paper.id}),
+ response = self.client.get(reverse('yaksh:download_quiz_csv',
+ kwargs={"course_id": self.course.id,
+ "quiz_id": self.quiz.id}),
+
follow=True
)
- file_name = "{0}.csv".format(self.quiz.description)
+ file_name = "{0}-{1}-attempt{2}.csv".format(self.course.name.replace('.', ''),
+ self.quiz.description.replace('.', ''), 1)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.get('Content-Disposition'),
'attachment; filename="{0}"'.format(file_name))