Skip to content

Commit

Permalink
addEventEntries: add ignoreEventGender; document; extend tests;
Browse files Browse the repository at this point in the history
CourtHive committed Jun 5, 2023
1 parent ee0fb19 commit fcbd298
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 5 additions & 4 deletions documentation/docs/apis/tournament-engine-api.md
Original file line number Diff line number Diff line change
@@ -187,11 +187,12 @@ a participant with `entryStatus: DIRECT_ACCEPTANCE`.
```js
tournamentEngine.addEventEntries({
eventId,
participantIds,
entryStage: MAIN, // optional
entryStatus: ALTERNATE, // optional
entryStatus: ALTERNATE, // optional; defaults to DIRECT_ACCEPTANCE
entryStage: MAIN, // optional; defaults to MAIN
autoEntryPositions, // optional - keeps entries ordered by entryStage/entryStatus and auto-increments
ignoreEventGender, // optional - override peson.sex correspondes to event.gender
participantIds,
eventId,
drawId, // optional - will add participantIds to specified flightProfile.flight[].drawEntries and drawDefinition.entries (if possible)
});
```
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ export function addEventEntries(params) {
autoEntryPositions = true,
participantIds = [],
entryStageSequence,
ignoreEventGender,
entryStage = MAIN,
tournamentRecord,
ignoreStageSpace,
@@ -99,7 +100,9 @@ export function addEventEntries(params) {

if (
validSingles &&
(!event.gender || event.gender === participant.person?.sex)
(!event.gender ||
ignoreEventGender ||
event.gender === participant.person?.sex)
) {
return true;
}
@@ -119,6 +122,7 @@ export function addEventEntries(params) {
if (
validSingles &&
event.gender &&
!ignoreEventGender &&
event.gender !== participant.person?.sex
) {
misMatchedGenderIds.push(participant.participantId);
Original file line number Diff line number Diff line change
@@ -43,4 +43,11 @@ it('throws an error on misgendered entries', () => {
participantIds: maleParticipantIds,
});
expect(result.success).toEqual(true);

result = tournamentEngine.addEventEntries({
ignoreEventGender: true,
participantIds,
eventId,
});
expect(result.success).toEqual(true);
});

0 comments on commit fcbd298

Please sign in to comment.