summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprathamesh2016-04-01 17:36:45 +0530
committerprathamesh2016-04-01 17:36:45 +0530
commit561168145ef75c0182ab0ee7d54779973b739e6c (patch)
treee309d7fb5f80219af2cf37ec98b5f3e5b2a57617
parent6517faffb2a9d1bef316700380df46abfb1c93b6 (diff)
downloadonline_test-561168145ef75c0182ab0ee7d54779973b739e6c.tar.gz
online_test-561168145ef75c0182ab0ee7d54779973b739e6c.tar.bz2
online_test-561168145ef75c0182ab0ee7d54779973b739e6c.zip
Minor changes due to model change
-rw-r--r--yaksh/models.py11
-rw-r--r--yaksh/templates/yaksh/quizzes_user.html2
-rw-r--r--yaksh/views.py3
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)