Skip to content

Conversation

@jmgasper
Copy link
Collaborator

No description provided.

@jmgasper jmgasper merged commit d1abf94 into develop Dec 15, 2025
5 checks passed
import cn from 'classnames'
import { PrimaryButton, OutlineButton } from '../../Buttons'
import { REVIEW_OPPORTUNITY_TYPE_LABELS, REVIEW_OPPORTUNITY_TYPES, VALIDATION_VALUE_TYPE, MARATHON_TYPE_ID, DES_TRACK_ID, CHALLENGE_PRIZE_TYPE } from '../../../config/constants'
import { REVIEW_OPPORTUNITY_TYPE_LABELS, REVIEW_OPPORTUNITY_TYPES, VALIDATION_VALUE_TYPE, MARATHON_TYPE_ID, DES_TRACK_ID } from '../../../config/constants'

Choose a reason for hiding this comment

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

[❗❗ correctness]
The import of CHALLENGE_PRIZE_TYPE has been removed, but it is still used in the code. Ensure that this constant is either re-imported or that its usage is removed or replaced.

getFirstPlacePrizeValue (challenge) {
const prizeSets = challenge.prizeSets || []
const placementPrizeSet = prizeSets.find(set => set.type === 'PLACEMENT')
const placementPrizeSet = challenge.prizeSets.find(set => set.type === 'PLACEMENT')

Choose a reason for hiding this comment

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

[⚠️ correctness]
The change assumes challenge.prizeSets is always defined, which may not be the case. Consider adding a check to ensure challenge.prizeSets is defined before calling .find() to avoid potential runtime errors.

const number = _.get(checkpointPrize, 'prizes.length') || DEFAULT_CHECKPOINT_PRIZE_COUNT
const amount = _.get(checkpointPrize, 'prizes.length') ? checkpointPrize.prizes[0].value : DEFAULT_CHECKPOINT_PRIZE
const prizeType = getPrizeType(prizeSets)
const prizeType = _.get(checkpointPrize, 'prizes[0].type') || getPrizeType(prizeSets)

Choose a reason for hiding this comment

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

[❗❗ correctness]
The use of _.get(checkpointPrize, 'prizes[0].type') assumes that prizes is an array and that prizes[0] exists. Consider adding a check to ensure prizes is an array and has at least one element to avoid potential runtime errors.

? <span className={styles.pointsLabel}>Pts</span>
: <FontAwesomeIcon className={styles.dollarIcon} icon={faDollarSign} />}
</div>
<input id='checkpointPrize' name='checkpointPrize' type='text' placeholder='' value={amount} maxLength='7' required onChange={(e) => onChange(number, e.target.value)} />

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The input element uses type='text' for a field that appears to represent a numeric value (amount). Consider using type='number' to leverage built-in browser validation and improve user experience.

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