mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-22 03:18:24 +02:00
Fix buttons for third round
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -626,8 +626,9 @@ class TournamentDetailView(MultiTableMixin, DetailView):
|
||||
context["notes"] = sorted_notes
|
||||
context["available_notes_1"] = all(pool.results_available for pool in self.object.pools.filter(round=1).all())
|
||||
context["available_notes_2"] = all(pool.results_available for pool in self.object.pools.filter(round=2).all())
|
||||
context["available_notes_3"] = all(pool.results_available for pool in self.object.pools.filter(round=3).all())
|
||||
|
||||
if not self.object.final and notes and context["available_notes_2"] \
|
||||
if settings.HAS_FINAL and not self.object.final and notes and context["available_notes_2"] \
|
||||
and not self.request.user.is_anonymous and self.request.user.registration.is_volunteer:
|
||||
context["team_selectable_for_final"] = next(participation for participation, _note in sorted_notes
|
||||
if not participation.final)
|
||||
@ -774,7 +775,7 @@ class TournamentHarmonizeView(VolunteerMixin, DetailView):
|
||||
reg = request.user.registration
|
||||
if not reg.is_admin and (not reg.is_volunteer or tournament not in reg.organized_tournaments.all()):
|
||||
return self.handle_no_permission()
|
||||
if self.kwargs['round'] not in (1, 2):
|
||||
if self.kwargs['round'] not in range(1, settings.NB_ROUNDS + 1):
|
||||
raise Http404
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
@ -807,7 +808,8 @@ class TournamentHarmonizeNoteView(VolunteerMixin, DetailView):
|
||||
reg = request.user.registration
|
||||
if not reg.is_admin and (not reg.is_volunteer or tournament not in reg.organized_tournaments.all()):
|
||||
return self.handle_no_permission()
|
||||
if self.kwargs['round'] not in (1, 2) or self.kwargs['action'] not in ('add', 'remove') \
|
||||
if self.kwargs['round'] not in range(1, settings.NB_ROUNDS + 1) \
|
||||
or self.kwargs['action'] not in ('add', 'remove') \
|
||||
or self.kwargs['trigram'] not in [p.team.trigram
|
||||
for p in tournament.participations.filter(valid=True).all()]:
|
||||
raise Http404
|
||||
@ -829,7 +831,7 @@ class TournamentHarmonizeNoteView(VolunteerMixin, DetailView):
|
||||
gc = gspread.service_account_from_dict(settings.GOOGLE_SERVICE_CLIENT)
|
||||
spreadsheet = gc.open_by_key(tournament.notes_sheet_id)
|
||||
worksheet = spreadsheet.worksheet("Classement final")
|
||||
column = 3 if kwargs['round'] == 1 else 5
|
||||
column = 3 if kwargs['round'] == 1 else 5 if kwargs['round'] == 2 else 8
|
||||
row = worksheet.find(f"{participation.team.name} ({participation.team.trigram})", in_column=1).row
|
||||
worksheet.update_cell(row, column, new_diff)
|
||||
|
||||
|
Reference in New Issue
Block a user