Skip to content

Commit

Permalink
refactor: ♻️ clarify data type Boolean for isCollectionMatchUp
Browse files Browse the repository at this point in the history
  • Loading branch information
CourtHive committed Dec 18, 2024
1 parent 3b98d86 commit 0646d8e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion documentation/docs/concepts/matchup-filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ The underlying `filterMatchUps` method is also exposed for direct use via the `m
```js
const matchUpFilters = {
matchUpFormat: 'SET3-S:6/TB7-F:TB10',
isCollectionMatchUp: false,
excludeMatchUpStatuses: [],
hasParticipantsCount: 2,
isCollectionMatchUp: [],
hasWinningSide: true,
isMatchUpTie: false,
matchUpStatuses: [],
Expand Down
2 changes: 1 addition & 1 deletion src/query/drawDefinition/matchUpActions/matchUpActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export function matchUpActions(params?: MatchUpActionsArgs): ResultType & {
if (!structureId) return { validActions };

const isAdHocMatchUp = isAdHoc({ structure });
const isCollectionMatchUp = matchUp.collectionId;
const isCollectionMatchUp = Boolean(matchUp.collectionId);

if (isAdHocMatchUp && !isCollectionMatchUp) {
const adHocValidActions = adHocMatchUpActions({
Expand Down
2 changes: 1 addition & 1 deletion src/query/structure/getStructureDrawPositionProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export function getStructureDrawPositionProfiles(params: GetStructureDrawPositio
const { drawDefinition, findContainer, structureId, event } = params;
let structure = params.structure;

const matchUpFilters = { isCollectionMatchUp: false };
const { containedStructures } = getContainedStructures({ drawDefinition });
const containedStructureIds = structureId ? containedStructures[structureId] || [] : [];
const matchUpFilters = { isCollectionMatchUp: false };

if (!structure) {
const result = findStructure({ drawDefinition, structureId });
Expand Down
2 changes: 1 addition & 1 deletion src/query/structure/getStructureMatchUps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export function getStructureMatchUps({

if (matchUp.matchUpType === TEAM) includesTeamMatchUps = true;

const isCollectionMatchUp = matchUp.collectionId;
const isCollectionMatchUp = Boolean(matchUp.collectionId);
const collectionSidesAssigned = isCollectionMatchUp && matchUp.sides?.every((side) => side.participantId);

const drawPositionsFilled = !isCollectionMatchUp && matchUp.drawPositions?.filter(Boolean).length === 2;
Expand Down

0 comments on commit 0646d8e

Please sign in to comment.