diff options
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 11 | ||||
-rw-r--r-- | yaksh/templates/yaksh/quizzes_user.html | 2 | ||||
-rw-r--r-- | yaksh/views.py | 3 |
3 files changed, 10 insertions, 6 deletions
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 @@ <div class="span14"> <div class="row"> <div class="span6"> - <h4><b><u> {{ course.name }} by {{ course.creator}}</u></b></h4> + <h4><b><u> {{ course.name }} by {{ course.creator }}</u></b></h4> </div> <div class="span6"> {% if user in course.requests.all %} <span class="label warning">Request Pending </span> 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) |