Get rid of redundant else if

This commit is contained in:
Kalle
2026-07-23 17:11:06 +03:00
parent e2171dceb6
commit c37b077627

View File

@@ -123,53 +123,6 @@ export class Tournament {
type,
}),
);
// xxx: lets aim to get rid of this else if
} else if (type === "swiss") {
const { teams, relevantMatchesFinished } = sources
? this.resolveTeamsFromSources(sources, bracketIdx)
: this.resolveTeamsFromSignups(bracketIdx);
const { checkedInTeams, notCheckedInTeams } =
this.divideTeamsToCheckedInAndNotCheckedIn({
teams,
bracketIdx,
usesRegularCheckIn: !sources,
requiresCheckIn,
});
this.brackets.push(
createBracket({
id: -1 * bracketIdx,
idx: bracketIdx,
tournament: this,
seeding: checkedInTeams,
preview: true,
name,
requiresCheckIn,
startTime: startTime ? databaseTimestampToDate(startTime) : null,
settings: settings ?? null,
data: Engine.create({
tournamentId: this.ctx.id,
name,
type: "swiss",
seeding: checkedInTeams,
settings: this.bracketManagerSettings(
settings,
type,
checkedInTeams.length,
),
}),
type,
sources,
createdAt: null,
canBeStarted:
(!startTime || startTime < databaseTimestampNow()) &&
checkedInTeams.length >= TOURNAMENT.ENOUGH_TEAMS_TO_START &&
(sources ? relevantMatchesFinished : this.regularCheckInHasEnded),
teamsPendingCheckIn:
bracketIdx !== 0 ? notCheckedInTeams : undefined,
}),
);
} else {
const { teams, relevantMatchesFinished } = sources
? this.resolveTeamsFromSources(sources, bracketIdx)