From 561168145ef75c0182ab0ee7d54779973b739e6c Mon Sep 17 00:00:00 2001 From: prathamesh Date: Fri, 1 Apr 2016 17:36:45 +0530 Subject: Minor changes due to model change --- yaksh/models.py | 11 +++++++---- yaksh/templates/yaksh/quizzes_user.html | 2 +- yaksh/views.py | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'yaksh') diff --git a/yaksh/models.py b/yaksh/models.py index bb8d193..30257ef 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -389,10 +389,13 @@ class AnswerPaperManager(models.Manager): ''' Return a dict of question id as key and count as value''' papers = self.filter(question_paper_id=questionpaper_id, attempt_number=attempt_number, status=status) + all_questions = list() questions = list() for paper in papers: - questions += paper.get_questions() - return Counter(map(int, questions)) + all_questions += paper.get_questions() + for question in all_questions: + questions.append(question.id) + return Counter(questions) def get_all_questions_answered(self, questionpaper_id, attempt_number, status='completed'): @@ -403,8 +406,8 @@ class AnswerPaperManager(models.Manager): for paper in papers: for question in filter(None, paper.get_questions_answered()): if paper.is_answer_correct(question): - questions_answered.append(question) - return Counter(map(int, questions_answered)) + questions_answered.append(question.id) + return Counter(questions_answered) def get_attempt_numbers(self, questionpaper_id, status='completed'): ''' Return list of attempt numbers''' diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html index 2ba7b6c..69cf3ba 100644 --- a/yaksh/templates/yaksh/quizzes_user.html +++ b/yaksh/templates/yaksh/quizzes_user.html @@ -21,7 +21,7 @@
-

{{ course.name }} by {{ course.creator}}

+

{{ course.name }} by {{ course.creator }}

{% if user in course.requests.all %} Request Pending diff --git a/yaksh/views.py b/yaksh/views.py index 30a9299..d06785f 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -1210,7 +1210,8 @@ def download_csv(request, questionpaper_id): paper.marks_obtained, paper.question_paper.total_marks, paper.percent, - paper.questions, paper.questions_answered, + paper.questions.all(), + paper.questions_answered.all(), paper.status ] writer.writerow(row) -- cgit