Skip to content

Commit 64280e1

Browse files
committed
fix for issue #4410
1 parent 4c94cb2 commit 64280e1

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/services/reviewOpportunities.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,25 @@
33
* @desc This module provides a service for retrieving Review Opportunities and
44
* submitting applications.
55
*/
6+
import _ from 'lodash';
67
import { getApi } from './api';
78

9+
/**
10+
* Sync the fields of V3 and V5 for front-end to process successfully
11+
* @param challenges - challenges to normalize
12+
*/
13+
export function normalizeChallenges(challenges) {
14+
if (challenges) {
15+
_.map(challenges, (ch) => {
16+
const { challenge } = ch;
17+
if (challenge.technologies && challenge.technologies.includes('Data Science')) {
18+
challenge.track = 'DATA_SCIENCE';
19+
}
20+
return _.defaults(ch, { challenge });
21+
});
22+
}
23+
return challenges;
24+
}
825
/**
926
* Service class.
1027
*/
@@ -31,7 +48,7 @@ class ReviewOpportunitiesService {
3148
.then(res => (res.ok ? res.json() : Promise.reject(new Error(`Error Code: ${res.status}`))))
3249
.then(res => (
3350
res.result.status === 200
34-
? res.result.content
51+
? normalizeChallenges(res.result.content)
3552
: Promise.reject(res.result.content)
3653
));
3754
}

0 commit comments

Comments
 (0)