Skip to content

Commit 263b20f

Browse files
committed
FIX SUBMISSION PHASE DISPLAY ON 2 ROUND CHALLENGE
1 parent c930000 commit 263b20f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/components/ChallengeEditor/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ class ChallengeEditor extends Component {
842842
moment(newChallenge.phases[index]['scheduledEndDate']).isAfter()
843843
if (newChallenge.phases[index].name === 'Submission') {
844844
newChallenge.phases[index].isStartTimeActive = true
845+
} else if (newChallenge.phases[index].name === 'Checkpoint Submission') {
846+
newChallenge.phases[index].isStartTimeActive = true
845847
} else {
846848
newChallenge.phases[index].isStartTimeActive = index <= 0
847849
}

src/reducers/challenges.js

+15
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ export default function (state = initialState, action) {
104104
case CREATE_CHALLENGE_FAILURE:
105105
return { ...state, isLoading: false, attachments: [], challenge: null, failedToLoad: true, errorMessage: _.get(action, 'error.response.data.message', '') }
106106
case LOAD_CHALLENGE_DETAILS_SUCCESS: {
107+
const phases = action.payload.phases
108+
const swapPhaseAtIndex = (phaseA, phaseB) => {
109+
const phaseAIndex = _.findIndex(phases, { name: phaseA })
110+
let phaseBIndex = _.findIndex(phases, { name: phaseB })
111+
if (phaseAIndex >= 0 && phaseBIndex >= 0) {
112+
const tmp = phases[phaseAIndex]
113+
phases.splice(phaseAIndex, 1)
114+
phaseBIndex = _.findIndex(phases, { name: phaseB })
115+
phases.splice(phaseBIndex, 0, tmp)
116+
}
117+
}
118+
swapPhaseAtIndex('Checkpoint Submission', 'Submission')
119+
swapPhaseAtIndex('Checkpoint Screening', 'Submission')
120+
swapPhaseAtIndex('Checkpoint Review', 'Submission')
121+
107122
return {
108123
...state,
109124
challengeDetails: { ...action.payload,

0 commit comments

Comments
 (0)