Skip to content

Commit

Permalink
dedicated student band filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ethrgeist committed Oct 25, 2024
1 parent 40a8d60 commit ae8c2c3
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/rockon/bands/static/js/voting.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ const TrackList = Vue.defineComponent({
<span v-for="track in tracks" :key="track" class="badge m-2" :class="track === selectedTrack ? 'text-bg-success' : 'text-bg-primary'" style="cursor: pointer;" @click="handleClick(track)">{{ track.name }}</span>
<span class="badge text-bg-primary m-2" :key="no-track" @click="handleShowBandsWithoutTrack" style="cursor: pointer;">Ohne Track</span>
<span class="badge text-bg-primary m-2" :key="no-vote" @click="handleShowBandsWithoutVote" style="cursor: pointer;">Unbewertete Bands</span>
<span class="badge text-bg-primary m-2" @click="handleShowStudentBands" style="cursor: pointer;">Schülerbands</span>
<span class="badge text-bg-primary m-2" @click="handleDeselectTrack" style="cursor: pointer;">Alle Bands</span>
<div class="form-check form-switch m-2">
<input class="form-check-input" type="checkbox" role="switch" :checked="showBandNoName" @change="handleFilterNoNameChange" />
Expand Down Expand Up @@ -207,6 +208,11 @@ const TrackList = Vue.defineComponent({
this.selectedTrack = 'no-track'
this.$emit('select-track', 'no-track')
},
handleShowStudentBands () {
console.debug('TrackList handleShowStudentBands')
this.selectedTrack = 'student-bands'
this.$emit('select-track', 'student-bands')
},
handleShowBandsWithoutVote () {
console.debug('TrackList handleShowBandsWithoutTrack')
this.selectedTrack = 'no-vote'
Expand Down Expand Up @@ -341,6 +347,10 @@ const BandList = Vue.defineComponent({
console.debug('Filtering for bands without a track.')
return _bands.filter(band => !band.track)
}
if (this.selectedTrack === 'student-bands') {
console.debug('Filtering for student bands.')
return _bands.filter(band => band.are_students)
}
if (this.selectedTrack === 'no-vote') {
console.debug('Filtering for bands without a track.')
_bands = _bands.filter(band => band.bid_status !== 'declined')
Expand Down Expand Up @@ -704,11 +714,11 @@ const app = createApp({
const url = new URL(window.location.href)
if (track === 'no-vote') {
url.pathname = `/event/${this.eventSlug}/bands/vote/track/no-vote/`
}
else if (track === 'no-track') {
} else if (track === 'no-track') {
url.pathname = `/event/${this.eventSlug}/bands/vote/track/no-track/`
}
else if (track) {
} else if (track === 'student-bands') {
url.pathname = `/event/${this.eventSlug}/bands/vote/track/student-bands/`
} else if (track) {
url.pathname = `/event/${this.eventSlug}/bands/vote/track/${track.slug}/`
} else {
url.pathname = `/event/${this.eventSlug}/bands/vote/`
Expand Down Expand Up @@ -776,6 +786,8 @@ const app = createApp({
track = this.selectedTrack = 'no-vote'
} else if (id === 'no-track') {
track = this.selectedTrack = 'no-track'
} else if (id === 'student-bands') {
track = this.selectedTrack = 'student-bands'
} else {
track = this.tracks.find(track => track.slug === id)
}
Expand Down

0 comments on commit ae8c2c3

Please sign in to comment.