diff options
author | prathamesh | 2016-04-01 17:36:45 +0530 |
---|---|---|
committer | prathamesh | 2016-04-01 17:36:45 +0530 |
commit | 561168145ef75c0182ab0ee7d54779973b739e6c (patch) | |
tree | e309d7fb5f80219af2cf37ec98b5f3e5b2a57617 /yaksh/models.py | |
parent | 6517faffb2a9d1bef316700380df46abfb1c93b6 (diff) | |
download | online_test-561168145ef75c0182ab0ee7d54779973b739e6c.tar.gz online_test-561168145ef75c0182ab0ee7d54779973b739e6c.tar.bz2 online_test-561168145ef75c0182ab0ee7d54779973b739e6c.zip |
Minor changes due to model change
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 11 |
1 files changed, 7 insertions, 4 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''' |