]> git.parisson.com Git - teleforma.git/commitdiff
fix message when step 4 is not validated
authorYoan Le Clanche <yoan@ellington.pilotsystems.net>
Fri, 21 Dec 2018 16:26:55 +0000 (17:26 +0100)
committerYoan Le Clanche <yoan@ellington.pilotsystems.net>
Fri, 21 Dec 2018 16:26:55 +0000 (17:26 +0100)
teleforma/context_processors.py
teleforma/views/pro.py

index c36a97a33eb51554d846517c51fed1f859a987e5..9d89bdbf44fe7fade3080848ae68a582eba62168 100644 (file)
@@ -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
index ac2e8c401d13c6871e448efbe6cde5a16e6ef932..12e0cd4da0f21e3cd45cee84acab5689831b87e5 100644 (file)
@@ -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: