From 55609ee4555a40d54162e507c0e5ef70bc7350af Mon Sep 17 00:00:00 2001 From: courthive Date: Tue, 9 Apr 2024 20:41:22 -0400 Subject: [PATCH] refactor: :technologist: code formatting --- documentation/docs/governors/participant-governor.md | 4 ++-- .../generators/drawDefinitions/generateFlightProfile.ts | 9 +++++---- src/tests/mutations/events/scaledFlightProfile.test.ts | 5 +++-- .../mutations/participants/scaledTeamAssignments.test.ts | 5 +++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/documentation/docs/governors/participant-governor.md b/documentation/docs/governors/participant-governor.md index 9607957e09..215bd949e7 100644 --- a/documentation/docs/governors/participant-governor.md +++ b/documentation/docs/governors/participant-governor.md @@ -402,10 +402,10 @@ Modifying team assignments has "global" effect, meaning that if a team appears i ```js const scaleAttributes = { + sortOrder: ASCENDING, // defaults to ASCENDING; use case for DESCENDING is unclear! scaleType: RANKING, eventType: SINGLES, scaleName: 'U18', - sortOrder: ASCENDING, // defaults to ASCENDING; use case for DESCENDING is unclear! }; engine.scaledTeamAssignment({ clearExistingAssignments, // optional - true by default remove all existing individualParticipantIds from targeted teams @@ -430,8 +430,8 @@ const scaleAttributes = { }; const scaledParticipants = individualParticipants.map((participant) => ({ - participantId: 'participantId', scaleValue: participantScaleItem({ participant, scaleAttributes }).scaleItem.scaleValue, + participantId: 'participantId', })); const teamParticipantIds = teamParticipants.map(getParticipantId); diff --git a/src/assemblies/generators/drawDefinitions/generateFlightProfile.ts b/src/assemblies/generators/drawDefinitions/generateFlightProfile.ts index dcfb22ada2..8c49f39ca3 100644 --- a/src/assemblies/generators/drawDefinitions/generateFlightProfile.ts +++ b/src/assemblies/generators/drawDefinitions/generateFlightProfile.ts @@ -1,17 +1,18 @@ import { attachFlightProfile as attachProfile } from '@Mutate/events/attachFlightProfile'; +import { chunkArray, chunkByNth, generateRange, shuffleArray } from '@Tools/arrays'; import { getScaledEntries } from '@Query/event/getScaledEntries'; import { getParticipantId } from '@Functions/global/extractors'; import { getFlightProfile } from '@Query/event/getFlightProfile'; import { getDevContext } from '@Global/state/globalState'; import { UUID } from '@Tools/UUID'; -import { chunkArray, chunkByNth, generateRange, shuffleArray } from '@Tools/arrays'; +// constants and types +import { EXISTING_PROFILE, ErrorType, MISSING_EVENT } from '@Constants/errorConditionConstants'; +import { Entry, Event, StageTypeUnion, Tournament } from '@Types/tournamentTypes'; +import { SPLIT_SHUTTLE, SPLIT_WATERFALL } from '@Constants/flightConstants'; import { DIRECT_ENTRY_STATUSES } from '@Constants/entryStatusConstants'; import { FlightProfile, ScaleAttributes } from '@Types/factoryTypes'; import { SUCCESS } from '@Constants/resultConstants'; -import { EXISTING_PROFILE, ErrorType, MISSING_EVENT } from '@Constants/errorConditionConstants'; -import { SPLIT_SHUTTLE, SPLIT_WATERFALL } from '@Constants/flightConstants'; -import { Entry, Event, StageTypeUnion, Tournament } from '@Types/tournamentTypes'; /** * @param {object} event - automatically retrieved by tournamentEngine given eventId diff --git a/src/tests/mutations/events/scaledFlightProfile.test.ts b/src/tests/mutations/events/scaledFlightProfile.test.ts index a89c08d656..b96f7274d2 100644 --- a/src/tests/mutations/events/scaledFlightProfile.test.ts +++ b/src/tests/mutations/events/scaledFlightProfile.test.ts @@ -1,13 +1,14 @@ -import { ensureInt } from '@Tools/ensureInt'; import mocksEngine from '@Assemblies/engines/mock'; import tournamentEngine from '@Engines/syncEngine'; +import { ensureInt } from '@Tools/ensureInt'; import { expect, it } from 'vitest'; +// constants +import { SPLIT_LEVEL_BASED, SPLIT_SHUTTLE, SPLIT_WATERFALL } from '@Constants/flightConstants'; import { MISSING_EVENT } from '@Constants/errorConditionConstants'; import { INDIVIDUAL } from '@Constants/participantConstants'; import { RANKING, RATING } from '@Constants/scaleConstants'; import { SINGLES } from '@Constants/eventConstants'; -import { SPLIT_LEVEL_BASED, SPLIT_SHUTTLE, SPLIT_WATERFALL } from '@Constants/flightConstants'; // turn on devContext to enable checking splitEntries value tournamentEngine.devContext(true); diff --git a/src/tests/mutations/participants/scaledTeamAssignments.test.ts b/src/tests/mutations/participants/scaledTeamAssignments.test.ts index ff19883ac1..12958ec5f1 100644 --- a/src/tests/mutations/participants/scaledTeamAssignments.test.ts +++ b/src/tests/mutations/participants/scaledTeamAssignments.test.ts @@ -1,17 +1,18 @@ import { participantScaleItem } from '@Query/participant/participantScaleItem'; import { getParticipantId } from '@Functions/global/extractors'; +import tournamentEngine from '@Engines/syncEngine'; import mocksEngine from '@Assemblies/engines/mock'; import { generateRange } from '@Tools/arrays'; -import tournamentEngine from '@Engines/syncEngine'; import { expect, it } from 'vitest'; +// constants +import { INVALID_PARTICIPANT_IDS, INVALID_VALUES, MISSING_VALUE } from '@Constants/errorConditionConstants'; import { TEAM_PARTICIPANT } from '@Constants/participantConstants'; import { SINGLES_EVENT, TEAM_EVENT } from '@Constants/eventConstants'; import { UNGROUPED } from '@Constants/entryStatusConstants'; import { COMPETITOR } from '@Constants/participantRoles'; import { ScaleAttributes } from '@Types/factoryTypes'; import { RANKING } from '@Constants/scaleConstants'; -import { INVALID_PARTICIPANT_IDS, INVALID_VALUES, MISSING_VALUE } from '@Constants/errorConditionConstants'; const EVENT_NAME = 'Team Event';