@@ -8,19 +8,31 @@ import { getApi } from './api';
8
8
9
9
/**
10
10
* Sync the fields of V3 and V5 for front-end to process successfully
11
- * @param challenges - challenges to normalize
11
+ * @param opportunities - opportunities to normalize
12
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' ;
13
+ export function normalizeChallenges ( opportunities ) {
14
+ if ( opportunities ) {
15
+ /* Issue#4739 : Temporary add track to review opportunities challenges
16
+ * until receive API V5 update. */
17
+ _ . map ( opportunities , ( opportunity ) => {
18
+ const { challenge } = opportunity ;
19
+ challenge . track = 'Development' ;
20
+ if ( challenge . technologies ) {
21
+ if ( challenge . technologies . includes ( 'Data Science' ) ) {
22
+ challenge . track = 'Data Science' ;
23
+ } else if ( challenge . technologies . includes ( 'QA' ) ) {
24
+ challenge . track = 'Quality Assurance' ;
25
+ }
26
+ } else if ( challenge . subTrack === 'TEST_SUITES' || challenge . subTrack === 'BUG_HUNT' ) {
27
+ challenge . track = 'Quality Assurance' ;
28
+ } else if ( challenge . track === 'DESIGN' ) {
29
+ challenge . track = 'Design' ;
19
30
}
20
- return _ . defaults ( ch , { challenge } ) ;
31
+ return _ . defaults ( opportunity , { challenge } ) ;
21
32
} ) ;
22
33
}
23
- return challenges ;
34
+
35
+ return opportunities ;
24
36
}
25
37
26
38
/**
0 commit comments