Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions tabbycat/checkins/templates/CheckInStatusContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
</div>

<div class="btn-group mb-md-0 mb-3" v-if="!isForVenues">
<button v-for="(optionState, optionKey) in this.filterByType"
:key="optionKey" type="button"
:class="['btn btn-outline-primary', optionState ? 'active' : '']"
@click="setListContext('filterByType', optionKey, !optionState)"
v-text="gettext(peopleFilterNames[optionKey])">
<button v-for="option in filterByTypeOptions"
:key="option.key" type="button"
:class="['btn btn-outline-primary', option.state ? 'active' : '']"
@click="setListContext('filterByType', option.key, !option.state)"
v-text="gettext(peopleFilterNames[option.key])">
</button>
</div>

Expand Down Expand Up @@ -158,6 +158,7 @@ export default {
tournamentSlug: String,
forAdmin: Boolean,
teamSize: Number,
prelimsCompleted: Boolean,
},
computed: {
statsAbsent: function () {
Expand All @@ -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
},
Expand Down
13 changes: 10 additions & 3 deletions tabbycat/checkins/templates/PeopleStatusMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -17,6 +17,7 @@ export default {
All: 'All',
Adjudicators: 'Only Adjudicators',
Debaters: 'Only Teams',
Breaking: 'Only Breaking',
},
speakerGroupingNames: {
Speaker: 'By Person',
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 () {
Expand Down
4 changes: 3 additions & 1 deletion tabbycat/checkins/templates/checkin_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
:assistant-url="assistantUrl"
:team-codes="teamCodes"
:for-admin="forAdmin"
:team-size="teamSize">
:team-size="teamSize"
:prelims-completed="prelimsCompleted">
</check-in-status-container>
</div>

Expand All @@ -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 %},
}
</script>
{{ block.super }}
Expand Down
15 changes: 14 additions & 1 deletion tabbycat/checkins/views.py
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 @@ -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)


Expand All @@ -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:
Expand All @@ -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)

Expand All @@ -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)

Expand Down