diff --git a/participation/views.py b/participation/views.py index 183e706..2753d8d 100644 --- a/participation/views.py +++ b/participation/views.py @@ -742,7 +742,7 @@ class TournamentHarmonizeView(VolunteerMixin, DetailView): .format(tournament=tournament, round=context["round"]) notes = dict() - for participation in self.object.participations.all(): + for participation in self.object.participations.filter(valid=True).all(): note = sum(pool.average(participation) for pool in context['pools']) tweak = sum(tweak.diff for tweak in participation.tweaks.filter(pool__in=context['pools']).all()) notes[participation] = {'note': note, 'tweak': tweak} @@ -762,13 +762,14 @@ class TournamentHarmonizeNoteView(VolunteerMixin, DetailView): 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') \ - or self.kwargs['trigram'] not in [p.team.trigram for p in tournament.participations.all()]: + or self.kwargs['trigram'] not in [p.team.trigram + for p in tournament.participations.filter(valid=True).all()]: raise Http404 return super().dispatch(request, *args, **kwargs) def get(self, request, *args, **kwargs): tournament = self.get_object() - participation = tournament.participations.get(team__trigram=kwargs['trigram']) + participation = tournament.participations.filter(valid=True).get(team__trigram=kwargs['trigram']) pool = tournament.pools.get(round=kwargs['round'], participations=participation) tweak_qs = Tweak.objects.filter(participation=participation, pool=pool) old_diff = tweak_qs.first().diff if tweak_qs.exists() else 0