Better times

This commit is contained in:
Yohann D'ANELLO 2020-05-05 23:06:32 +02:00
parent 75d8ec2265
commit 36bbe95fc3
2 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import random import random
import zipfile import zipfile
from datetime import timedelta
from io import BytesIO from io import BytesIO
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
@ -239,9 +240,9 @@ class SolutionsView(TeamMixin, BaseFormView, SingleTableView):
solution.team = self.request.user.team solution.team = self.request.user.team
solution.final = solution.team.selected_for_final solution.final = solution.team.selected_for_final
if timezone.now() > solution.tournament.date_solutions: if timezone.now() > solution.tournament.date_solutions + timedelta(minutes=30):
form.add_error('file', _("You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %H:%M}.") form.add_error('file', _("You can't publish your solution anymore. Deadline: {date:%m-%d-%Y %H:%M}.")
.format(date=solution.tournament.date_solutions)) .format(date=timezone.localtime(solution.tournament.date_solutions)))
return super().form_invalid(form) return super().form_invalid(form)
prev_sol = Solution.objects.filter(problem=solution.problem, team=solution.team, final=solution.final) prev_sol = Solution.objects.filter(problem=solution.problem, team=solution.team, final=solution.final)
@ -347,16 +348,16 @@ class SynthesesView(TeamMixin, BaseFormView, SingleTableView):
synthesis.team = self.request.user.team synthesis.team = self.request.user.team
synthesis.final = synthesis.team.selected_for_final synthesis.final = synthesis.team.selected_for_final
if synthesis.round == '1' and timezone.now() > synthesis.tournament.date_syntheses: if synthesis.round == '1' and timezone.now() > (synthesis.tournament.date_syntheses + timedelta(minutes=30)):
form.add_error('file', _("You can't publish your synthesis anymore for the first round." form.add_error('file', _("You can't publish your synthesis anymore for the first round."
" Deadline: {date:%m-%d-%Y %H:%M}.") " Deadline: {date:%m-%d-%Y %H:%M}.")
.format(date=synthesis.tournament.date_syntheses)) .format(date=timezone.localtime(synthesis.tournament.date_syntheses)))
return super().form_invalid(form) return super().form_invalid(form)
if synthesis.round == '2' and timezone.now() > synthesis.tournament.date_syntheses_2: if synthesis.round == '2' and timezone.now() > synthesis.tournament.date_syntheses_2 + timedelta(minutes=30):
form.add_error('file', _("You can't publish your synthesis anymore for the second round." form.add_error('file', _("You can't publish your synthesis anymore for the second round."
" Deadline: {date:%m-%d-%Y %H:%M}.") " Deadline: {date:%m-%d-%Y %H:%M}.")
.format(date=synthesis.tournament.date_syntheses_2)) .format(date=timezone.localtime(synthesis.tournament.date_syntheses_2)))
return super().form_invalid(form) return super().form_invalid(form)
prev_syn = Synthesis.objects.filter(team=synthesis.team, round=synthesis.round, source=synthesis.source, prev_syn = Synthesis.objects.filter(team=synthesis.team, round=synthesis.round, source=synthesis.source,

View File

@ -30,9 +30,15 @@
<dt class="col-xl-6 text-right">{% trans 'date of maximal solution submission'|capfirst %}</dt> <dt class="col-xl-6 text-right">{% trans 'date of maximal solution submission'|capfirst %}</dt>
<dd class="col-xl-6">{{ tournament.date_solutions }}</dd> <dd class="col-xl-6">{{ tournament.date_solutions }}</dd>
<dt class="col-xl-6 text-right">{% trans 'date of maximal syntheses submission'|capfirst %}</dt> <dt class="col-xl-6 text-right">{% trans 'date of maximal syntheses submission for the first round'|capfirst %}</dt>
<dd class="col-xl-6">{{ tournament.date_syntheses }}</dd> <dd class="col-xl-6">{{ tournament.date_syntheses }}</dd>
<dt class="col-xl-6 text-right">{% trans 'date when solutions of round 2 are available'|capfirst %}</dt>
<dd class="col-xl-6">{{ tournament.date_solutions_2 }}</dd>
<dt class="col-xl-6 text-right">{% trans 'date of maximal syntheses submission for the second round'|capfirst %}</dt>
<dd class="col-xl-6">{{ tournament.date_syntheses_2 }}</dd>
<dt class="col-xl-6 text-right">{% trans 'description'|capfirst %}</dt> <dt class="col-xl-6 text-right">{% trans 'description'|capfirst %}</dt>
<dd class="col-xl-6">{{ tournament.description }}</dd> <dd class="col-xl-6">{{ tournament.description }}</dd>
</dl> </dl>