@property
def questions_with_user_answers(self):
- return {q : q.user_answer for q in self.get_questions(with_answers=True)}
+ return {
+ q: q.user_answer for q in self.get_questions(with_answers=True)
+ }
@property
def get_max_score(self):
self.assertIn('123', self.sitting.user_answers)
def test_return_questions_with_answers(self):
+ '''
+ Also tests sitting.get_questions(with_answers=True)
+ '''
self.sitting.add_user_answer(self.question1, '123')
self.sitting.add_user_answer(self.question2, '456')
def get_context_data(self, **kwargs):
context = super(QuizMarkingDetail, self).get_context_data(**kwargs)
- context['questions'] = context['sitting'].get_questions(with_answers=True)
+ context['questions'] =\
+ context['sitting'].get_questions(with_answers=True)
return context
+
class QuizTake(FormView):
form_class = QuestionForm
template_name = 'question.html'
self.sitting.mark_quiz_complete()
if self.quiz.answers_at_end:
- results['questions'] = self.sitting.get_questions(with_answers=True)
+ results['questions'] =\
+ self.sitting.get_questions(with_answers=True)
results['incorrect_questions'] =\
self.sitting.get_incorrect_questions