feat: support double-elimination series games
This commit is contained in:
1 parent
2ee8c3807b
commit
e188828423
16 files changed
+1176
-234
No files matched your search
+14
-7
@@ -151,7 +151,13 @@ export interface TournamentCodeUniqueIndexMigrationResult {
|
||||
}
|
||||
|
||||
export interface TournamentCodeUniqueIndexMigrationProgress {
|
||||
action?: 'alreadyCorrect' | 'create' | 'created' | 'drop' | 'dropped' | 'list';
|
||||
action?:
|
||||
| 'alreadyCorrect'
|
||||
| 'create'
|
||||
| 'created'
|
||||
| 'drop'
|
||||
| 'dropped'
|
||||
| 'list';
|
||||
phase:
|
||||
| 'scanMatches'
|
||||
| 'scanTournamentCodes'
|
||||
@@ -205,7 +211,6 @@ const DESIRED_TOURNAMENT_CODE_INDEXES: DesiredIndex[] = [
|
||||
key: { matchId: 1, bracketMatchId: 1 },
|
||||
options: {
|
||||
name: 'matchId_1_bracketMatchId_1',
|
||||
unique: true,
|
||||
partialFilterExpression: {
|
||||
matchId: { $exists: true },
|
||||
bracketMatchId: { $exists: true },
|
||||
@@ -414,7 +419,6 @@ function findDuplicateGroups(
|
||||
): DuplicateGroup[] {
|
||||
return [
|
||||
...duplicateGroupsFor(docs, referencedCodeIds, 'gameNumber'),
|
||||
...duplicateGroupsFor(docs, referencedCodeIds, 'bracketMatchId'),
|
||||
...duplicateGroupsFor(docs, referencedCodeIds, 'riotMatchId'),
|
||||
];
|
||||
}
|
||||
@@ -514,7 +518,8 @@ function summarizeCode(doc: TournamentCodeDoc): TournamentCodeDuplicateSummary {
|
||||
bracketMatchId:
|
||||
doc.bracketMatchId === undefined ? undefined : String(doc.bracketMatchId),
|
||||
code: doc.code === undefined ? undefined : String(doc.code),
|
||||
gameNumber: doc.gameNumber === undefined ? undefined : String(doc.gameNumber),
|
||||
gameNumber:
|
||||
doc.gameNumber === undefined ? undefined : String(doc.gameNumber),
|
||||
id: stringifyId(doc._id) ?? '',
|
||||
matchId: doc.matchId === undefined ? undefined : stringifyId(doc.matchId),
|
||||
riotMatchId:
|
||||
@@ -576,7 +581,9 @@ function compareCodePriority(
|
||||
const rightDate = latestTimestamp(right);
|
||||
if (leftDate !== rightDate) return rightDate - leftDate;
|
||||
|
||||
return (stringifyId(left._id) ?? '').localeCompare(stringifyId(right._id) ?? '');
|
||||
return (stringifyId(left._id) ?? '').localeCompare(
|
||||
stringifyId(right._id) ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
function stateRank(state: unknown): number {
|
||||
@@ -715,8 +722,8 @@ function isNamespaceNotFoundError(error: unknown): boolean {
|
||||
};
|
||||
return Boolean(
|
||||
candidate?.code === 26 ||
|
||||
candidate?.codeName === 'NamespaceNotFound' ||
|
||||
candidate?.message?.includes('ns does not exist'),
|
||||
candidate?.codeName === 'NamespaceNotFound' ||
|
||||
candidate?.message?.includes('ns does not exist'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user