Skip to content

Fix Open For Review changes filter #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 27, 2020
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
10 changes: 10 additions & 0 deletions __tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
@@ -377,6 +377,16 @@ Object {
"DEVELOP": "Development",
"QA": "Quality Assurance",
},
"OLD_COMPETITION_TRACKS": Object {
"DATA_SCIENCE": "DATA_SCIENCE",
"DESIGN": "DESIGN",
"DEVELOP": "DEVELOP",
"QA": "QA",
},
"OLD_SUBTRACKS": Object {
"BUG_HUNT": "BUG_HUNT",
"TEST_SUITES": "TEST_SUITES",
},
"REVIEW_OPPORTUNITY_TYPES": Object {
"Contest Review": "Review",
"Iterative Review": "Iterative Review",
32 changes: 23 additions & 9 deletions src/services/reviewOpportunities.js
Original file line number Diff line number Diff line change
@@ -4,23 +4,37 @@
* submitting applications.
*/
import _ from 'lodash';
import { COMPETITION_TRACKS, OLD_COMPETITION_TRACKS, OLD_SUBTRACKS } from 'utils/tc';
import { getApi } from './api';

/**
* Sync the fields of V3 and V5 for front-end to process successfully
* @param challenges - challenges to normalize
* @param opportunities - opportunities to normalize
*/
export function normalizeChallenges(challenges) {
if (challenges) {
_.map(challenges, (ch) => {
const { challenge } = ch;
if (challenge.technologies && challenge.technologies.includes('Data Science')) {
challenge.track = 'DATA_SCIENCE';
export function normalizeChallenges(opportunities) {
if (opportunities) {
/* Issue#4739 : Temporary add track to review opportunities challenges
* until receive API V5 update. */
_.map(opportunities, (opportunity) => {
const { challenge } = opportunity;
challenge.track = COMPETITION_TRACKS.DEVELOP;
if (challenge.technologies) {
if (challenge.technologies.includes(COMPETITION_TRACKS.DATA_SCIENCE)) {
challenge.track = COMPETITION_TRACKS.DATA_SCIENCE;
} else if (challenge.technologies.includes(OLD_COMPETITION_TRACKS.QA)) {
challenge.track = COMPETITION_TRACKS.QA;
}
} else if (challenge.subTrack === OLD_SUBTRACKS.TEST_SUITES
|| challenge.subTrack === OLD_SUBTRACKS.BUG_HUNT) {
challenge.track = COMPETITION_TRACKS.QA;
} else if (challenge.track === OLD_COMPETITION_TRACKS.DESIGN) {
challenge.track = COMPETITION_TRACKS.DESIGN;
}
return _.defaults(ch, { challenge });
return _.defaults(opportunity, { challenge });
});
}
return challenges;

return opportunities;
}

/**
12 changes: 12 additions & 0 deletions src/utils/tc.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,18 @@ export const COMPETITION_TRACKS = {
QA: 'Quality Assurance',
};

export const OLD_COMPETITION_TRACKS = {
DATA_SCIENCE: 'DATA_SCIENCE',
DESIGN: 'DESIGN',
DEVELOP: 'DEVELOP',
QA: 'QA',
};

export const OLD_SUBTRACKS = {
TEST_SUITES: 'TEST_SUITES',
BUG_HUNT: 'BUG_HUNT',
};

/**
* Review Opportunity types
*/