From: Yoan Le Clanche Date: Fri, 21 Dec 2018 16:26:55 +0000 (+0100) Subject: fix message when step 4 is not validated X-Git-Tag: 2.8.1-pro~201 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b8b5e1b0b0631e7905d507823184c7e0e34dfbb3;p=teleforma.git fix message when step 4 is not validated --- diff --git a/teleforma/context_processors.py b/teleforma/context_processors.py index c36a97a3..9d89bdbf 100644 --- a/teleforma/context_processors.py +++ b/teleforma/context_processors.py @@ -74,15 +74,23 @@ def seminar_progress(user, seminar, more=False): missing_steps.add(step) questions = Question.objects.filter(seminar=seminar, status=3) + missing_step4 = None for question in questions: if question.weight: total += question.weight - answer = Answer.objects.filter(question=question, status=3, user=user, - validated=True, treated=True) + answer = Answer.objects.filter(question=question, status=3, user=user) if answer: + answer = answer[0] + if answer and answer.validated and answer.treated: progress += question.weight else: - missing_steps.add('4') + # import pdb;pdb.set_trace() + if answer and not answer.treated and not missing_step4 == '4': + missing_step4 = '4.5' + else: + missing_step4 = '4' + if missing_step4: + missing_steps.add(missing_step4) if seminar.quiz: quiz_weight = 3 diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index ac2e8c40..12e0cd4d 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -278,8 +278,7 @@ class SeminarView(SeminarAccessMixin, DetailView): elif progress == 100 and validated and delta_sec >= 0 and self.template_name == 'teleforma/seminar_detail.html': messages.info(self.request, _("You have successfully terminated all steps of your e-learning seminar. You can now download your training testimonial below.")) elif len(missing_steps) == 1: - print missing_steps - if missing_steps == set('4'): + if missing_steps == set(['4.5']): messages.warning(self.request, _("Yours submissions have been submitted. They will be processed within 48 hours.")) else: