File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ Object {
342
342
" reviewOpportunities" : Object {
343
343
" default" : undefined ,
344
344
" getReviewOpportunitiesService" : [Function ],
345
+ " normalizeChallenges" : [Function ],
345
346
},
346
347
" submissions" : Object {
347
348
" default" : undefined ,
Original file line number Diff line number Diff line change 3
3
* @desc This module provides a service for retrieving Review Opportunities and
4
4
* submitting applications.
5
5
*/
6
+ import _ from 'lodash' ;
6
7
import { getApi } from './api' ;
7
8
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
+ }
8
25
/**
9
26
* Service class.
10
27
*/
@@ -31,7 +48,7 @@ class ReviewOpportunitiesService {
31
48
. then ( res => ( res . ok ? res . json ( ) : Promise . reject ( new Error ( `Error Code: ${ res . status } ` ) ) ) )
32
49
. then ( res => (
33
50
res . result . status === 200
34
- ? res . result . content
51
+ ? normalizeChallenges ( res . result . content )
35
52
: Promise . reject ( res . result . content )
36
53
) ) ;
37
54
}
You can’t perform that action at this time.
0 commit comments