X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fhelpers%2FRound.js;h=f662defaa4d5f23bc476127b55a458ab6fc4a04e;hb=601947fac408c56023badfaafc9d47cb7e57a0f7;hp=086517e2f897ec1a79bc709800a0c4b08114b5ad;hpb=c59d0714d62f9028135cc9cff829d16b91e5fb4f;p=alttp.git diff --git a/resources/js/helpers/Round.js b/resources/js/helpers/Round.js index 086517e..f662def 100644 --- a/resources/js/helpers/Round.js +++ b/resources/js/helpers/Round.js @@ -1,8 +1,15 @@ +import Participant from './Participant'; +import Tournament from './Tournament'; + export const isComplete = (tournament, round) => { if (!tournament || !tournament.participants) return false; if (!round || !round.results) return false; - return tournament.participants.length === round.results.length && - round.results.filter(r => !r.has_finished).length === 0; + const runners = Tournament.getRunners(tournament); + for (let i = 0; i < runners.length; ++i) { + const result = Participant.findResult(runners[i], round); + if (!result || !result.has_finished) return false; + } + return true; }; export const patchResult = (round, result) => {