Skip to content

Conversation

@jmgasper
Copy link
Contributor

No description provided.

@jmgasper jmgasper merged commit e62c379 into master Nov 22, 2025
6 of 7 checks passed
): Promise<void> {
await this.challengeApiService.completeChallenge(challengeId, winners);
// Trigger finance payments generation after marking the challenge as completed
void this.financeApiService.generateChallengePayments(challengeId);

Choose a reason for hiding this comment

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

[⚠️ correctness]
The use of void to ignore the promise returned by generateChallengePayments could lead to unhandled errors if the promise is rejected. Consider handling the promise explicitly to ensure any errors are logged or managed appropriately.

});

resourcesService.getMemberHandleMap.mockResolvedValue(
new Map([['4001', 'resolvedHandle']]),

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider checking if the getMemberHandleMap method could potentially return null or undefined instead of a Map. If so, ensure that the code handles such cases to prevent runtime errors.

}

const memberIdRaw = payload.submitterMemberId ?? '';
const numericMemberId = Number(memberIdRaw);

Choose a reason for hiding this comment

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

[⚠️ correctness]
The conversion of memberIdRaw to numericMemberId using Number() could result in NaN if memberIdRaw is not a valid number. Consider using parseInt() or parseFloat() with appropriate checks to ensure the conversion is intentional and correct.

challenge.id,
[String(memberIdRaw)],
);
handle = handleMap.get(String(memberIdRaw)) ?? handle;

Choose a reason for hiding this comment

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

[💡 readability]
The use of String(memberIdRaw) in the getMemberHandleMap call is redundant since memberIdRaw is already a string. Consider removing the String() conversion for clarity.

[
{
userId: numericMemberId,
handle: handle && handle.length ? handle : String(memberIdRaw),

Choose a reason for hiding this comment

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

[💡 style]
The conditional check handle && handle.length is unnecessary. handle.length alone suffices to check if the string is non-empty.

appealsSuccessors,
);

if (callbackResult instanceof Promise) {

Choose a reason for hiding this comment

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

[💡 maintainability]
The check for callbackResult instanceof Promise is redundant since await can handle both promises and non-promises. Consider removing this check to simplify the code.

)
: result.next.phases;

if (!phasesToOpen.length) {

Choose a reason for hiding this comment

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

[💡 performance]
The check if (!phasesToOpen.length) is performed after filtering result.next.phases. If result.next.phases is empty, the filter operation is unnecessary. Consider checking the length of result.next.phases before filtering to avoid unnecessary operations.

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