Skip to content

Commit

Permalink
refactor: 🥅 getStructureReports: handle old tournaments where `flig…
Browse files Browse the repository at this point in the history
…htNumbers` are not present in `flightProfile`
  • Loading branch information
CourtHive committed Apr 8, 2024
1 parent 6e6f976 commit 2cb7154
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/query/structure/structureReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ type GetStructureReportsArgs = {
firstFlightOnly?: boolean;
};

export function getStructureReports({
firstFlightOnly = true,
extensionProfiles,
tournamentRecord,
}: GetStructureReportsArgs) {
export function getStructureReports(params: GetStructureReportsArgs) {
const { tournamentRecord, extensionProfiles, firstFlightOnly } = params;
if (!tournamentRecord) return { error: MISSING_TOURNAMENT_ID };

const mainStructures: any[] = [];
Expand Down Expand Up @@ -85,7 +82,7 @@ export function getStructureReports({
const drawDeletionsTimeItem = eventTimeItems?.find((x) => x.itemType === DRAW_DELETIONS);
const drawDeletionsCount = drawDeletionsExtension?.value?.length || drawDeletionsTimeItem?.itemValue || 0;

const mapValues: number[] = Object.values(flightMap);
const mapValues: number[] = Object.values(flightMap ?? {});
const minFlightNumber = flightMap && Math.min(...mapValues);

const eventSeedingBasis = getSeedingBasis(eventTimeItems);
Expand Down

0 comments on commit 2cb7154

Please sign in to comment.