Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add function for qualifier progression #3480

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

mgallagher-reid
Copy link
Collaborator

Automatically add qualified participants to main draw structure qualifier draw positions

);
if (structure?.stage !== QUALIFYING) continue;

const structureCompleted = isCompletedStructure({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Round Robins structures must always be completed because otherwise there will be no finishingPosition available, so checking whether completion is required is irrelevant

}: QualifierProgressionArgs): ResultType {
const qualifyingParticipantIds: string[] = [];

const structure = findStructure({ drawDefinition, structureId: mainStructureId })?.structure ?? ({} as Structure);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be more comfortable if this were explicitly mainStructure

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can we trust that the value passed in as mainStructureI is actually the structure id of MAIN? I think we should check that the found structure.stage === MAIN and structure.stageSequence === 1 or throw an error.

And, why even require the mainstructureId to be passed in? Since it is always the only structure we're interested in, why not just derive it from the drawDefinition since we want to check anyway?

event,
mainStructureId,
tournamentRecord,
}: QualifierProgressionArgs): ResultType {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could usefully add:

const paramsCheck = checkRequiredParameters(params, [{ [DRAW_DEFINITION]: true, [EVENT]: true, [TOURNAMENT_RECORD]: true }]);
if (paramsCheck.error) return paramsCheck;

});

return decorateResult({
result: definedAttributes({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to return an array of assignedParticipantIds
It doesn't look like qualifiedDrawPositionAssignment returns the position to which the assignment was made...

@@ -5,7 +5,7 @@ import { findStructure } from '@Acquire/findStructure';
type GetSourceStructureDetailArgs = {
drawDefinition: DrawDefinition;
finishingPosition?: string;
targetRoundNumber: number;
targetRoundNumber?: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think that targetRoundNumber should be required to be passed by new function qualifierProgression and should be a parameter of qualifierProgression with a default value of 1

@CourtHive CourtHive merged commit 4b5be8f into master Dec 13, 2024
2 checks passed
@CourtHive CourtHive deleted the feat/qualifier-progression branch December 13, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants