Skip to content

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Oct 24, 2025

https://topcoder.atlassian.net/browse/PM-1105 - handle challenge checkpoint winners

@vas3a vas3a requested review from jmgasper and kkartunov October 24, 2025 06:59
generateWinnersPayments(challenge: Challenge): PaymentPayload[] {
const { prizeSets, winners } = challenge;

generateWinnersPayments(

Choose a reason for hiding this comment

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

[⚠️ correctness]
The function signature has been changed to accept winners and prizes as separate parameters, but the original challenge parameter already contains these properties. This change could lead to redundancy and potential inconsistencies if the winners or prizes parameters differ from those in the challenge object. Consider using the properties directly from the challenge object to maintain consistency and reduce the risk of errors.

'desc',
);

if ((checkpointPrizes?.length ?? 0) < (checkpointWinners?.length ?? 0)) {

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The error message could be more informative by including the actual numbers of checkpoint winners and prizes. Consider including these values to aid debugging.

);
}

if (!checkpointPrizes?.length) {

Choose a reason for hiding this comment

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

[💡 maintainability]
The check for !checkpointPrizes?.length is redundant since the previous condition already ensures that checkpointPrizes has at least as many elements as checkpointWinners. Consider removing this check to simplify the code.

overview: PrizeOverview;
winners: Winner[]; // Replace with type if needed
winners: Winner[];
checkpointWinners: Winner[];

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider adding validation or constraints to ensure that checkpointWinners is correctly populated and does not contain duplicates or invalid entries. This will help maintain data integrity and prevent potential issues with incorrect winner data.

@vas3a vas3a merged commit b9bfb17 into v6 Oct 24, 2025
1 check passed
@vas3a vas3a deleted the PM-1105_checkpoint-winners branch October 24, 2025 13:47
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