From 1f554e7505f5a6aa1b796b2e31e1541188af56da Mon Sep 17 00:00:00 2001 From: prathamesh Date: Thu, 26 Oct 2017 14:35:08 +0530 Subject: 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. --- yaksh/models.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 787daa6..97f2f0b 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -826,6 +826,13 @@ class QuestionPaper(models.Model): objects = QuestionPaperManager() + def get_question_bank(self): + ''' Gets all the questions in the question paper''' + questions = list(self.fixed_questions.all()) + for random_set in self.random_questions.all(): + questions += list(random_set.questions.all()) + return questions + def _create_duplicate_questionpaper(self, quiz): new_questionpaper = QuestionPaper.objects.create(quiz=quiz, shuffle_questions=self.shuffle_questions, @@ -1185,6 +1192,15 @@ class AnswerPaper(models.Model): objects = AnswerPaperManager() + def get_per_question_score(self, question_id): + if question_id not in self.get_questions().values_list('id', flat=True): + return 'NA' + answer = self.get_latest_answer(question_id) + if answer: + return answer.marks + else: + return 0 + def current_question(self): """Returns the current active question to display.""" unanswered_questions = self.questions_unanswered.all() -- cgit From b5e481dde6fac34cf1e7e86b3c32d9ca74151fa2 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Tue, 7 Nov 2017 11:11:34 +0530 Subject: Fix test cases --- yaksh/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index cb9b481..4b5d553 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -82,6 +82,8 @@ test_status = ( ('completed', 'Completed'), ) +FIXTURES_DIR_PATH = os.path.join(settings.BASE_DIR, 'yaksh/fixtures/') + def get_assignment_dir(instance, filename): upload_dir = instance.question_paper.quiz.description.replace(" ", "_") @@ -544,7 +546,7 @@ class Question(models.Model): def create_demo_questions(self, user): zip_file_path = os.path.join( - settings.FIXTURE_DIRS, 'demo_questions.zip' + FIXTURES_DIR_PATH, 'demo_questions.zip' ) files, extract_path = extract_files(zip_file_path) self.read_yaml(extract_path, user, files) -- cgit From 6fb9f74ee9d2de9a8fb6714907da52a3ed870431 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Wed, 8 Nov 2017 16:03:10 +0530 Subject: - Add pytest as a requirement to the requirements file - Modify image name in tasks.py --- yaksh/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yaksh/models.py') diff --git a/yaksh/models.py b/yaksh/models.py index 4b5d553..d698232 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -82,7 +82,7 @@ test_status = ( ('completed', 'Completed'), ) -FIXTURES_DIR_PATH = os.path.join(settings.BASE_DIR, 'yaksh/fixtures/') +FIXTURES_DIR_PATH = os.path.join(settings.BASE_DIR, 'yaksh', 'fixtures') def get_assignment_dir(instance, filename): -- cgit