From f077e6447b5ea2f0acc87c50bc0fd1d74f74f8bc Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 21 Jul 2014 23:40:04 +0200 Subject: [PATCH] try seminar time constraint --- teleforma/templates/teleforma/seminar_detail.html | 2 +- teleforma/views/pro.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/teleforma/templates/teleforma/seminar_detail.html b/teleforma/templates/teleforma/seminar_detail.html index f9c66945..0050a6eb 100644 --- a/teleforma/templates/teleforma/seminar_detail.html +++ b/teleforma/templates/teleforma/seminar_detail.html @@ -196,7 +196,7 @@ $(window).ready(function( ){ {% endwith %} {% endif %} - {% if seminar_validated and seminar_progress == 100 %} + {% if seminar_validated and seminar_progress == 100 and seminar_time >= 0 %}

{% trans "Step" %} 7 : {% trans "download your testimonial" %}

diff --git a/teleforma/views/pro.py b/teleforma/views/pro.py index 1f27555c..01608e44 100644 --- a/teleforma/views/pro.py +++ b/teleforma/views/pro.py @@ -59,7 +59,7 @@ from forms_builder.forms.forms import FormForForm from forms_builder.forms.models import Form from forms_builder.forms.signals import form_invalid, form_valid -REVISION_DATE_FILTER = datetime.datetime(2014,7,19) +REVISION_DATE_FILTER = datetime.datetime(2014,7,21) def content_to_pdf(content, dest, encoding='utf-8', **kwargs): @@ -161,6 +161,7 @@ class SeminarView(SeminarAccessMixin, DetailView): context = super(SeminarView, self).get_context_data(**kwargs) seminar = context['seminar'] user = self.request.user + progress = seminar_progress(user, seminar) validated = seminar_validated(user, seminar) context['seminar_progress'] = progress @@ -171,8 +172,14 @@ class SeminarView(SeminarAccessMixin, DetailView): 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.")) + delta = self.get_delta(user, seminar) context['delta'] = str(delta).split('.')[0] + #TODO + if datetime.datetime.now > REVISION_DATE_FILTER: + context['seminar_time'] = delta - datetime.timedelta(seconds=seminar.duration.as_seconds()) + else: + context['seminar_time'] = 1 return context @jsonrpc_method('teleforma.publish_seminar') -- 2.39.5