diff --git a/tabbycat/checkins/templates/CheckInStatusContainer.vue b/tabbycat/checkins/templates/CheckInStatusContainer.vue index 768058ed24d..36f9c16a263 100644 --- a/tabbycat/checkins/templates/CheckInStatusContainer.vue +++ b/tabbycat/checkins/templates/CheckInStatusContainer.vue @@ -16,7 +16,20 @@ -
+ +
+ +
+ +
@@ -30,6 +32,8 @@ 'teamCodes': {{ team_codes }}, 'forAdmin': {% if for_admin %}true{% else %}false{% endif %}, 'teamSize': {{ team_size }}, + 'breakingTeamShortNames': {{ breaking_team_short_names|safe }}, + 'isBreakRound': {% if is_break_round %}true{% else %}false{% endif %}, } {{ block.super }} diff --git a/tabbycat/checkins/views.py b/tabbycat/checkins/views.py index c7ad269f185..997f02f2dc5 100644 --- a/tabbycat/checkins/views.py +++ b/tabbycat/checkins/views.py @@ -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 @@ -67,7 +68,17 @@ 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_short_names(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.short_name for breaking_team in breaking_teams) + def get_context_data(self, **kwargs): + breaking_team_short_names = self.get_breaking_team_short_names() team_codes = use_team_code_names(self.tournament, admin=self.for_admin, user=self.request.user) kwargs["team_codes"] = json.dumps(team_codes) @@ -83,12 +94,15 @@ def get_context_data(self, **kwargs): adjudicators.append({ 'id': adj.id, 'name': adj.get_public_name(self.tournament), 'type': 'Adjudicator', 'identifier': [code], 'locked': False, 'independent': adj.independent, - 'institution': institution, + 'institution': institution, 'breaking': adj.breaking, }) kwargs["adjudicators"] = json.dumps(adjudicators) speakers = [] for speaker in Speaker.objects.filter(team__tournament=self.tournament).select_related('team', 'team__institution', 'checkin_identifier'): + breaking = False + if speaker.team.code_name in breaking_team_short_names: + breaking = True try: code = speaker.checkin_identifier.barcode except ObjectDoesNotExist: @@ -100,8 +114,11 @@ def get_context_data(self, **kwargs): 'identifier': [code], 'locked': False, 'team': speaker.team.code_name if team_codes else speaker.team.short_name, 'institution': institution, + 'breaking': breaking, }) kwargs["speakers"] = json.dumps(speakers) + kwargs["is_break_round"] = self.is_break_round() + kwargs["breaking_team_short_names"] = json.dumps(list(breaking_team_short_names)) return super().get_context_data(**kwargs)