Skip to content

Commit

Permalink
attempt to still get ordinal on report preview set promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlee337 committed Feb 19, 2025
1 parent 65813ee commit 2c0ee25
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/main/startgg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,16 +867,20 @@ const REPORT_BRACKET_SET_MUTATION = `
export async function reportSet(key: string, set: StartggSet) {
const updatedAtMs = Date.now();
const data = await fetchGql(key, REPORT_BRACKET_SET_MUTATION, set);
const updatedSets = (data.reportBracketSet as any[])
.filter(
(bracketSet) =>
bracketSet.slots[0].entrant && bracketSet.slots[1].entrant,
)
.map((bracketSet) => {
const updatedSet = gqlSetToSet(bracketSet, updatedAtMs);
idToSet.set(updatedSet.id, updatedSet);
return updatedSet;
});
const filteredSets = (data.reportBracketSet as any[]).filter(
(bracketSet) => bracketSet.slots[0].entrant && bracketSet.slots[1].entrant,
);
if (
filteredSets.some((filteredSet) => !setIdToOrdinal.has(filteredSet.id)) &&
selectedPhaseGroupId
) {
await getPhaseGroup(key, selectedPhaseGroupId);
}
const updatedSets = filteredSets.map((bracketSet) => {
const updatedSet = gqlSetToSet(bracketSet, updatedAtMs);
idToSet.set(updatedSet.id, updatedSet);
return updatedSet;
});
const reportedSet = updatedSets.filter(
(updatedSet) => updatedSet.state === State.COMPLETED,
)[0];
Expand Down

0 comments on commit 2c0ee25

Please sign in to comment.