mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-24 15:08:44 -05:00
Give better error message to TO when can't check-in a team
This commit is contained in:
parent
edf55abb9f
commit
0cb5f09def
|
|
@ -836,18 +836,21 @@ export class Tournament {
|
|||
invariant(team, "Team not found");
|
||||
|
||||
if (!this.regularCheckInIsOpen && !this.regularCheckInHasEnded) {
|
||||
return false;
|
||||
return { isFulfilled: false, reason: "Check in has not yet started" };
|
||||
}
|
||||
|
||||
if (team.members.length < this.minMembersPerTeam) {
|
||||
return false;
|
||||
return {
|
||||
isFulfilled: false,
|
||||
reason: `Team needs at least ${this.minMembersPerTeam} members`,
|
||||
};
|
||||
}
|
||||
|
||||
if (this.teamsPrePickMaps && (!team.mapPool || team.mapPool.length === 0)) {
|
||||
return false;
|
||||
return { isFulfilled: false, reason: "Team has no map pool set" };
|
||||
}
|
||||
|
||||
return true;
|
||||
return { isFulfilled: true, reason: null };
|
||||
}
|
||||
|
||||
get isInvitational() {
|
||||
|
|
@ -1163,9 +1166,11 @@ export class Tournament {
|
|||
}
|
||||
|
||||
if (team.checkIns.length === 0 && this.regularCheckInIsOpen) {
|
||||
const canCheckIn = this.checkInConditionsFulfilledByTeamId(team.id);
|
||||
|
||||
return { type: "CHECKIN", canCheckIn } as const;
|
||||
return {
|
||||
type: "CHECKIN",
|
||||
canCheckIn: this.checkInConditionsFulfilledByTeamId(team.id)
|
||||
.isFulfilled,
|
||||
} as const;
|
||||
}
|
||||
|
||||
for (const [bracketIdx, bracket] of this.brackets.entries()) {
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ export const action: ActionFunction = async ({ request, params }) => {
|
|||
errorToastIfFalsy(team, "Invalid team id");
|
||||
errorToastIfFalsy(
|
||||
data.bracketIdx !== 0 ||
|
||||
tournament.checkInConditionsFulfilledByTeamId(team.id),
|
||||
"Can't check-in",
|
||||
tournament.checkInConditionsFulfilledByTeamId(team.id).isFulfilled,
|
||||
`Can't check-in - ${tournament.checkInConditionsFulfilledByTeamId(team.id).reason}`,
|
||||
);
|
||||
errorToastIfFalsy(
|
||||
team.checkIns.length > 0 || data.bracketIdx === 0,
|
||||
|
|
|
|||
|
|
@ -222,8 +222,9 @@ export const action: ActionFunction = async ({ request, params }) => {
|
|||
"Check in is not open",
|
||||
);
|
||||
errorToastIfFalsy(
|
||||
tournament.checkInConditionsFulfilledByTeamId(teamMemberOf.id),
|
||||
"Check in conditions not fulfilled",
|
||||
tournament.checkInConditionsFulfilledByTeamId(teamMemberOf.id)
|
||||
.isFulfilled,
|
||||
`Can't check-in - ${tournament.checkInConditionsFulfilledByTeamId(teamMemberOf.id).reason}`,
|
||||
);
|
||||
|
||||
checkIn(teamMemberOf.id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user