Skip to content

Commit

Permalink
add small delay in multimatch and multipoint games, and dont redirect…
Browse files Browse the repository at this point in the history
… back to swiss on final game if possible
  • Loading branch information
JamesHeppell committed Feb 5, 2025
1 parent 4a90fd9 commit d468e2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ui/draughtsround/src/view/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ export function backToTournament(ctrl: RoundController): VNode | undefined {

export function backToSwiss(ctrl: RoundController): VNode | undefined {
const d = ctrl.data;
if (d.swiss?.running && (d.swiss?.isBestOfX || d.swiss?.isPlayX)) {
const moreGamesInMultiMatch = d.game.multiMatch.index < ctrl.data.swiss?.nbGamesPerRound;
if (d.swiss?.running && moreGamesInMultiMatch) {
ctrl.setRedirecting();
setTimeout(() => {
location.href = '/swiss/' + d.swiss?.id;
Expand Down
1 change: 1 addition & 0 deletions ui/game/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export interface Swiss {
running?: boolean;
isBestOfX?: boolean;
isPlayX?: boolean;
nbGamesPerRound?: number;
isMultiPoint?: boolean;
ranks?: TournamentRanks;
}
Expand Down
11 changes: 8 additions & 3 deletions ui/round/src/view/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,15 @@ export function backToTournament(ctrl: RoundController): VNode | undefined {

export function backToSwiss(ctrl: RoundController): VNode | undefined {
const d = ctrl.data;
if (d.swiss?.running && (d.swiss?.isBestOfX || d.swiss?.isPlayX || d.swiss?.isMultiPoint)) {
const mps = ctrl.finalMultiPointState();
const moreGamesInMultiMatch = d.game.multiMatch.index < ctrl.data.swiss?.nbGamesPerRound;
const moreGamesInMultiPoint = mps && mps.p1 < mps.target && mps.p2 < mps.target;
if (d.swiss?.running && (moreGamesInMultiMatch || moreGamesInMultiPoint)) {
ctrl.setRedirecting();
location.href = '/swiss/' + d.swiss?.id;
return undefined;
setTimeout(() => {
location.href = '/swiss/' + d.swiss?.id;
return undefined;
}, 2500);
}
return d.swiss?.running
? h('div.follow-up', [
Expand Down

0 comments on commit d468e2c

Please sign in to comment.