From: Guillaume Pellerin Date: Mon, 1 Feb 2016 14:12:49 +0000 (+0100) Subject: fix no quiz X-Git-Tag: 2.8.1-pro~235 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8914ee11f23a6295f6a362c13d27051eb43c2b86;p=teleforma.git fix no quiz --- diff --git a/teleforma/context_processors.py b/teleforma/context_processors.py index 6a47a3a9..903bdff3 100644 --- a/teleforma/context_processors.py +++ b/teleforma/context_processors.py @@ -60,11 +60,12 @@ def seminar_progress(user, seminar): if answer: progress += question.weight - quiz_weight = 3 - quiz_validations = QuizValidation.objects.filter(user=user, quiz=seminar.quiz, validated=True) - total += quiz_weight - if quiz_validations: - progress += quiz_weight + if seminar.quiz: + quiz_weight = 3 + quiz_validations = QuizValidation.objects.filter(user=user, quiz=seminar.quiz, validated=True) + total += quiz_weight + if quiz_validations: + progress += quiz_weight if total != 0: return int(progress*100/total)