diff --git a/tabbycat/checkins/templates/CheckInStatusContainer.vue b/tabbycat/checkins/templates/CheckInStatusContainer.vue index 768058ed24d..4a90da30216 100644 --- a/tabbycat/checkins/templates/CheckInStatusContainer.vue +++ b/tabbycat/checkins/templates/CheckInStatusContainer.vue @@ -17,11 +17,11 @@
-
@@ -158,6 +158,7 @@ export default { tournamentSlug: String, forAdmin: Boolean, teamSize: Number, + prelimsCompleted: Boolean, }, computed: { statsAbsent: function () { @@ -179,6 +180,16 @@ export default { filterByType: function () { return this.isForVenues ? this.venuesFilterByType : this.peopleFilterByType }, + filterByTypeOptions: function () { + const options = [] + _.forEach(this.filterByType, (state, key) => { + if (key === 'Breaking' && !this.prelimsCompleted) { + return + } + options.push({ key: key, state: state }) + }) + return options + }, sortByGroup: function () { return this.isForVenues ? this.venuesSortByGroup : this.peopleSortByGroup }, diff --git a/tabbycat/checkins/templates/PeopleStatusMixin.vue b/tabbycat/checkins/templates/PeopleStatusMixin.vue index dcaf73aafaa..66d65a77b0c 100644 --- a/tabbycat/checkins/templates/PeopleStatusMixin.vue +++ b/tabbycat/checkins/templates/PeopleStatusMixin.vue @@ -5,7 +5,7 @@ export default { data: function () { return { peopleFilterByType: { - All: true, Adjudicators: false, Debaters: false, + All: true, Adjudicators: false, Debaters: false, Breaking: false, }, peopleSortByGroup: { Institution: !this.teamCodes, Name: this.teamCodes, Time: false, @@ -17,6 +17,7 @@ export default { All: 'All', Adjudicators: 'Only Adjudicators', Debaters: 'Only Teams', + Breaking: 'Only Breaking', }, speakerGroupingNames: { Speaker: 'By Person', @@ -98,6 +99,7 @@ export default { speakersIn: teamSpeakers.length - _.filter(teamSpeakers, ['status', false]).length, institution: institution, identifier: _.flatten(_.map(teamSpeakers, 'identifier')), + breaking: _.some(teamSpeakers, speaker => speaker.breaking), } // Show as green if everyone in if (_.filter(team.speakers, ['status', false]).length > 0) { @@ -128,16 +130,21 @@ export default { }, peopleByType: function () { const entities = [] - if (this.filterByType.All || this.filterByType.Adjudicators) { + const includeAdjudicators = this.filterByType.All || this.filterByType.Adjudicators || this.filterByType.Breaking + if (includeAdjudicators) { _.forEach(this.annotatedAdjudicators, (adjudicator) => { entities.push(adjudicator) }) } - if (this.filterByType.All || this.filterByType.Debaters) { + const includeDebaters = this.filterByType.All || this.filterByType.Debaters || this.filterByType.Breaking + if (includeDebaters) { _.forEach(this.annotatedDebaters, (speakerOrTeam) => { entities.push(speakerOrTeam) }) } + if (this.filterByType.Breaking) { + return _.filter(entities, person => person.breaking) + } return entities }, peopleByInstitution: function () { diff --git a/tabbycat/checkins/templates/checkin_status.html b/tabbycat/checkins/templates/checkin_status.html index 69679486030..fab64202fb0 100644 --- a/tabbycat/checkins/templates/checkin_status.html +++ b/tabbycat/checkins/templates/checkin_status.html @@ -12,7 +12,8 @@ :assistant-url="assistantUrl" :team-codes="teamCodes" :for-admin="forAdmin" - :team-size="teamSize"> + :team-size="teamSize" + :prelims-completed="prelimsCompleted"> @@ -30,6 +31,7 @@ 'teamCodes': {{ team_codes }}, 'forAdmin': {% if for_admin %}true{% else %}false{% endif %}, 'teamSize': {{ team_size }}, + 'prelimsCompleted': {% if prelims_completed %}true{% else %}false{% endif %}, } {{ block.super }} diff --git a/tabbycat/checkins/views.py b/tabbycat/checkins/views.py index c7ad269f185..93da07d57be 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 @@ -57,6 +58,7 @@ def get_context_data(self, **kwargs): kwargs["scan_url"] = self.tournament.slug + '/checkins/' kwargs["for_admin"] = self.for_admin kwargs["team_size"] = self.tournament.pref('substantive_speakers') + kwargs.setdefault("prelims_completed", False) return super().get_context_data(**kwargs) @@ -72,6 +74,16 @@ def get_context_data(self, **kwargs): team_codes = use_team_code_names(self.tournament, admin=self.for_admin, user=self.request.user) kwargs["team_codes"] = json.dumps(team_codes) + prelims_completed = not self.tournament.prelim_rounds().filter(completed=False).exists() + kwargs["prelims_completed"] = prelims_completed + + breaking_team_ids = set( + BreakingTeam.objects.filter( + break_category__tournament=self.tournament, + remark__isnull=True, + ).values_list('team_id', flat=True), + ) + adjudicators = [] for adj in self.tournament.relevant_adjudicators.all().select_related('institution', 'checkin_identifier'): try: @@ -83,7 +95,7 @@ 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) @@ -100,6 +112,7 @@ 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': speaker.team_id in breaking_team_ids, }) kwargs["speakers"] = json.dumps(speakers)