X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhelpers%2FTournament.js;h=7dbcb9b5b294386c8d4a725eeeacdcbb64b854da;hb=a748d5724c8acff6e3bb3fe6c20aa5968b65d58a;hp=ec141d12829b9758405314e052ddeae2aba9d7d7;hpb=84f8491f7f503162a503bfbfc35d8585015b56dd;p=alttp.git diff --git a/resources/js/helpers/Tournament.js b/resources/js/helpers/Tournament.js index ec141d1..7dbcb9b 100644 --- a/resources/js/helpers/Tournament.js +++ b/resources/js/helpers/Tournament.js @@ -29,6 +29,20 @@ export const getTournamentAdmins = tournament => { .sort(Participant.compareUsername); }; +export const getTournamentCrew = tournament => { + if (!tournament || !tournament.participants || !tournament.participants.length) return []; + return tournament.participants + .filter(Participant.isTournamentCrew) + .sort(Participant.compareUsername); +}; + +export const getTournamentMonitors = tournament => { + if (!tournament || !tournament.participants || !tournament.participants.length) return []; + return tournament.participants + .filter(Participant.isTournamentMonitor) + .sort(Participant.compareUsername); +}; + export const hasRunners = tournament => { return getRunners(tournament).length > 0; }; @@ -37,6 +51,14 @@ export const hasTournamentAdmins = tournament => { return getTournamentAdmins(tournament).length > 0; }; +export const hasTournamentCrew = tournament => { + return getTournamentCrew(tournament).length > 0; +}; + +export const hasTournamentMonitors = tournament => { + return getTournamentMonitors(tournament).length > 0; +}; + export const patchParticipant = (tournament, participant) => { if (!tournament) return tournament; if (!tournament.participants || !tournament.participants.length) { @@ -103,6 +125,12 @@ export default { findParticipant, getRunners, getTournamentAdmins, + getTournamentCrew, + getTournamentMonitors, + hasRunners, + hasTournamentAdmins, + hasTournamentCrew, + hasTournamentMonitors, patchResult, patchRound, patchUser,