Skip to content

Commit 5885c35

Browse files
authored
Merge pull request topcoder-platform#206 from narekcat/issue-4619
fix: #issue 4619, sync the fields for V3 and V5 for challenge phases
2 parents ca92a73 + d5dbe0d commit 5885c35

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/services/reviewOpportunities.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ export function normalizeChallenges(challenges) {
2222
}
2323
return challenges;
2424
}
25+
26+
/**
27+
* Sync the fields of V3 and V5 for front-end to process successfully
28+
* @param challenge - challenge to normalize
29+
*/
30+
function normalizeChallengePhases(challenge) {
31+
return {
32+
...challenge,
33+
phases: _.map(challenge.phases, phase => ({
34+
...phase,
35+
scheduledStartDate: phase.scheduledStartTime,
36+
scheduledEndDate: phase.scheduledEndTime,
37+
})),
38+
};
39+
}
40+
2541
/**
2642
* Service class.
2743
*/
@@ -64,8 +80,10 @@ class ReviewOpportunitiesService {
6480
.then(res => res.json())
6581
.then(res => (
6682
res.result.status === 200
67-
? res.result.content
68-
: Promise.reject(res.result)
83+
? {
84+
...res.result.content,
85+
challenge: normalizeChallengePhases(res.result.content.challenge),
86+
} : Promise.reject(res.result)
6987
));
7088
}
7189

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy