Skip to content

Conversation

@kkartunov
Copy link
Collaborator

hentrymartin and others added 7 commits May 7, 2025 23:44
fix(PM-1192): showing wrong review scorecard link
Previously, the sorting failed when getFinal() returned undefined. Now we fallback to getSubmissionDate() in case of anonymous user

Fixes PM-1055
Fix(registrants): sort by submitted date correctly
phases,
} = challenge;

const getScoreCardByPhase = (phaseName) => {

Choose a reason for hiding this comment

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

Consider adding error handling or a default return value in getScoreCardByPhase in case phases is undefined or does not contain the expected structure. This will prevent potential runtime errors.

} = challenge;

const getScoreCardByPhase = (phaseName) => {
const phase = phases.find(item => item.name === phaseName);

Choose a reason for hiding this comment

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

The find method will return undefined if no matching phase is found. Ensure that phase is checked before attempting to access phase.constraints to avoid potential errors.


const getScoreCardByPhase = (phaseName) => {
const phase = phases.find(item => item.name === phaseName);
const scoreCardConstraint = phase && phase.constraints && phase.constraints.find(item => item.name === 'Scorecard');

Choose a reason for hiding this comment

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

Consider checking if phase.constraints is an array before calling find on it to prevent runtime errors if constraints is not defined or not an array.

}),
metadata: PT.array,
events: PT.arrayOf(PT.string),
phases: PT.arrayOf(PT.any),

Choose a reason for hiding this comment

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

Using PT.any for phases prop type is not specific and can lead to potential issues with type checking. Consider defining a more specific prop type that accurately reflects the expected structure of the phases array.

@kkartunov kkartunov merged commit 609d44c into master May 13, 2025
8 checks passed
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.

3 participants