Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/shared/utils/reviewOpportunities.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ export const getReviewOpportunitiesFilterFunction = (state, validTypes) => (opp)
'Quality Assurance': 'QA',
};

const normalizedTrackMap = {
DEVELOPMENT: 'Dev',
DEVELOP: 'Dev',
DEV: 'Dev',
DESIGN: 'Des',
DES: 'Des',
'DATA SCIENCE': 'DS',
DATA_SCIENCE: 'DS',
DATASCIENCE: 'DS',
QA: 'QA',
'QUALITY ASSURANCE': 'QA',
QUALITY_ASSURANCE: 'QA',
};

const { challengeData } = opp;

// const newType = _.find(validTypes, { name: opp.challenge.type }) || {};
Expand All @@ -135,7 +149,9 @@ export const getReviewOpportunitiesFilterFunction = (state, validTypes) => (opp)
// communities: new Set([ // Used to filter by Track, and communities at a future date
// opp.challenge.track === 'QA' ? 'Dev' : trackAbbr[opp.challenge.track],
// ]),
track: trackAbbr[challengeData.track],
track: normalizedTrackMap[(challengeData.track || '').toString().trim().toUpperCase()]
Copy link

Choose a reason for hiding this comment

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

[❗❗ correctness]
The use of toString().trim().toUpperCase() for normalizing challengeData.track could lead to unexpected behavior if challengeData.track is null or undefined. Consider using optional chaining or a default value to ensure safety.

|| trackAbbr[challengeData.track]
|| challengeData.track,
typeId: newType.abbreviation,
tags: challengeData.technologies || [],
platforms: challengeData.platforms || [],
Expand Down
Loading