From: Guillaume Pellerin Date: Fri, 21 Nov 2014 15:20:27 +0000 (+0100) Subject: add message when delta time is lower than seminar resquested time X-Git-Tag: 2.8.1-pro~282^2~48 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=07403885e83a14eb80686aab4522a578b5e84ee1;p=teleforma.git add message when delta time is lower than seminar resquested time --- diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index cf0387bc..895f7bd5 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -166,17 +166,21 @@ class SeminarView(SeminarAccessMixin, DetailView): validated = seminar_validated(user, seminar) context['seminar_progress'] = progress context['seminar_validated'] = validated + + delta = self.get_delta(user, seminar) + time = delta - datetime.timedelta(seconds=seminar.duration.as_seconds()) + context['seminar_time'] = time.total_seconds() + context['delta'] = str(delta).split('.')[0] + if progress == 100 and not validated and self.template_name == 'teleforma/seminar_detail.html': messages.info(self.request, _("You have successfully terminated your e-learning seminar. A training testimonial will be available as soon as the pedagogical team validate all your answers (48h maximum).")) elif progress < 100 and validated and self.template_name == 'teleforma/seminar_detail.html': messages.info(self.request, _("All your answers have been validated. You can now read the corrected documents (step 5).")) elif progress == 100 and validated 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.")) + if progress == 100 and validated and delta <= 0: + messages.info(self.request, _("Your connexion time is not sufficient. In order to get your testimonial, you have to work at least the time required for this seminar.")) - delta = self.get_delta(user, seminar) - time = delta - datetime.timedelta(seconds=seminar.duration.as_seconds()) - context['seminar_time'] = time.total_seconds() - context['delta'] = str(delta).split('.')[0] return context @jsonrpc_method('teleforma.publish_seminar')