X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhelpers%2FTournament.js;h=7270351512938a2f3481244d9dca91bf0c8679dd;hb=d518ede5ffe8d4e44b0194279a9f32839bc1f903;hp=8f2239f1695c2a87515d5cf876784b1ef4b769f7;hpb=68d65789e2b64cd32d778c1e69a346521d2e38d6;p=alttp.git diff --git a/resources/js/helpers/Tournament.js b/resources/js/helpers/Tournament.js index 8f2239f..7270351 100644 --- a/resources/js/helpers/Tournament.js +++ b/resources/js/helpers/Tournament.js @@ -30,6 +30,20 @@ export const getRunners = tournament => { .sort(Participant.compareUsername); }; +export const getLastRound = tournament => { + if (!tournament || !tournament.rounds || !tournament.rounds.length) return null; + return tournament.rounds.slice(-1)[0]; +}; + +export const canLoadMoreRounds = tournament => { + const last_round = getLastRound(tournament); + return last_round && last_round.number > 1; +}; + +export const hasScoreboard = tournament => !!(tournament && tournament.type === 'signup-async'); + +export const hasSignup = tournament => !!(tournament && tournament.type === 'signup-async'); + export const getScoreTable = tournament => { if (!tournament || !tournament.rounds || !tournament.rounds.length) return []; const runners = getRunners(tournament); @@ -190,6 +204,8 @@ export default { getTournamentCrew, getTournamentMonitors, hasRunners, + hasScoreboard, + hasSignup, hasTournamentAdmins, hasTournamentCrew, hasTournamentMonitors,