X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhelpers%2FTournament.js;h=7270351512938a2f3481244d9dca91bf0c8679dd;hb=816690cc4fadff954f4407999550f7feec2884da;hp=9d2962d27c5e3f4a63ee2a6cc58f526b068bff22;hpb=537b998e8059c56e3a20ee2a89d42c3bbfbb80b8;p=alttp.git diff --git a/resources/js/helpers/Tournament.js b/resources/js/helpers/Tournament.js index 9d2962d..7270351 100644 --- a/resources/js/helpers/Tournament.js +++ b/resources/js/helpers/Tournament.js @@ -30,6 +30,16 @@ 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');