Skip to content

Commit

Permalink
Only pick relevant props in get.seeding()
Browse files Browse the repository at this point in the history
  • Loading branch information
Drarig29 committed Mar 23, 2023
1 parent 896c258 commit f4f8ec1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,16 @@ export class Get extends BaseGetter {
const stage = await this.storage.select('stage', stageId);
if (!stage) throw Error('Stage not found.');

const pickRelevantProps = (slot: ParticipantSlot): ParticipantSlot => {
if (slot === null) return null;
const { id, position } = slot;
return { id, position };
};

if (stage.type === 'round_robin')
return this.roundRobinSeeding(stage);
return (await this.roundRobinSeeding(stage)).map(pickRelevantProps);

return this.eliminationSeeding(stage);
return (await this.eliminationSeeding(stage)).map(pickRelevantProps);
}

/**
Expand Down

0 comments on commit f4f8ec1

Please sign in to comment.