Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show only breaking participants in check-in screen #2556

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
14 changes: 14 additions & 0 deletions tabbycat/checkins/views.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd have to set breaking_team_short_names for CheckInVenuesStatusView as well

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from actionlog.mixins import LogActionMixin
from actionlog.models import ActionLogEntry
from breakqual.models import BreakingTeam
from options.utils import use_team_code_names
from participants.models import Person, Speaker
from participants.serializers import InstitutionSerializer
Expand Down Expand Up @@ -67,7 +68,18 @@ class CheckInPeopleStatusView(BaseCheckInStatusView):

edit_permission = Permission.EDIT_PARTICIPANT_CHECKIN

def is_break_round(self):
"""Checks if the current round is a break round."""
break_rounds = self.tournament.break_rounds()
return self.tournament.current_round in break_rounds

def get_breaking_team_ids(self):
breaking_teams = BreakingTeam.objects.filter(break_category__tournament=self.tournament).select_related('team', 'team__institution', 'break_category', 'break_category__tournament').all()
return set(breaking_team.team.id for breaking_team in breaking_teams)

def get_context_data(self, **kwargs):
if self.is_break_round():
breaking_team_ids = self.get_breaking_team_ids()

team_codes = use_team_code_names(self.tournament, admin=self.for_admin, user=self.request.user)
kwargs["team_codes"] = json.dumps(team_codes)
Expand All @@ -89,6 +101,8 @@ def get_context_data(self, **kwargs):

speakers = []
for speaker in Speaker.objects.filter(team__tournament=self.tournament).select_related('team', 'team__institution', 'checkin_identifier'):
if self.is_break_round() and speaker.team.id not in breaking_team_ids:
continue
try:
code = speaker.checkin_identifier.barcode
except ObjectDoesNotExist:
Expand Down
Loading