fix: make competition reversals replayable
This commit is contained in:
1 parent
4d6fa2625e
commit
ce07bfa0c8
6 files changed
+169
-13
No files matched your search
@@ -666,20 +666,17 @@ function projectGamesAndSlots(
|
||||
} {
|
||||
const acceptedByFactId = new Map<string, AcceptedGameProjectionFact>();
|
||||
const activeBySlotId = new Map<string, AcceptedGameProjectionFact>();
|
||||
const voidedSlotIds = new Set<string>();
|
||||
|
||||
for (const fact of projectionGameFacts(facts)) {
|
||||
if (fact.type === 'game-accepted') {
|
||||
acceptedByFactId.set(fact.id, fact);
|
||||
activeBySlotId.set(fact.gameSlotId, fact);
|
||||
voidedSlotIds.delete(fact.gameSlotId);
|
||||
continue;
|
||||
}
|
||||
const accepted = acceptedByFactId.get(fact.gameAcceptedFactId);
|
||||
if (!accepted) continue;
|
||||
if (activeBySlotId.get(accepted.gameSlotId)?.id === accepted.id) {
|
||||
activeBySlotId.delete(accepted.gameSlotId);
|
||||
voidedSlotIds.add(accepted.gameSlotId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,9 +753,7 @@ function projectGamesAndSlots(
|
||||
const game = activeBySlotId.get(slot.id);
|
||||
const status = game
|
||||
? ('completed' as const)
|
||||
: voidedSlotIds.has(slot.id)
|
||||
? ('voided' as const)
|
||||
: gameSlotStatus(projected.status);
|
||||
: gameSlotStatus(projected.status);
|
||||
return {
|
||||
id: slot.id,
|
||||
seriesId: definition.id,
|
||||
|
||||
Reference in new issue
Block a user