Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

What's in this PR?

  • show respective scorecard types for respective review phase type

Ticket link - https://topcoder.atlassian.net/browse/PM-2609

const { challenge, metadata = {}, readOnly = false } = this.props
const { scorecards = [], workflows = [] } = metadata
const validationErrors = challenge.submitTriggered ? this.validateReviewer(reviewer) : {}
const selectedPhase = challenge.phases.find(p => p.phaseId === reviewer.phaseId)

Choose a reason for hiding this comment

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

[❗❗ correctness]
The selectedPhase variable is assigned using find, which will return undefined if no matching phase is found. This could lead to potential runtime errors when accessing properties of selectedPhase later in the code. Consider adding a check to handle the case where selectedPhase is undefined.

const validationErrors = challenge.submitTriggered ? this.validateReviewer(reviewer) : {}
const selectedPhase = challenge.phases.find(p => p.phaseId === reviewer.phaseId)
const isDesignChallenge = challenge && challenge.trackId === DES_TRACK_ID
const filteredScorecards = scorecards.filter(item => item.type?.toLowerCase() === selectedPhase?.name.toLowerCase());

Choose a reason for hiding this comment

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

[❗❗ correctness]
The filteredScorecards array is filtered based on selectedPhase?.name.toLowerCase(). If selectedPhase is undefined, this will result in an error. Ensure selectedPhase is not undefined before attempting to access its properties.

@jmgasper jmgasper merged commit 94fc1c6 into develop Oct 28, 2025
6 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