Skip to content

Commit

Permalink
FIX SUBMISSION PHASE DISPLAY ON 2 ROUND CHALLENGE
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgasper committed Jan 18, 2023
1 parent c930000 commit 263b20f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,8 @@ class ChallengeEditor extends Component {
moment(newChallenge.phases[index]['scheduledEndDate']).isAfter()
if (newChallenge.phases[index].name === 'Submission') {
newChallenge.phases[index].isStartTimeActive = true
} else if (newChallenge.phases[index].name === 'Checkpoint Submission') {
newChallenge.phases[index].isStartTimeActive = true
} else {
newChallenge.phases[index].isStartTimeActive = index <= 0
}
Expand Down
15 changes: 15 additions & 0 deletions src/reducers/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ export default function (state = initialState, action) {
case CREATE_CHALLENGE_FAILURE:
return { ...state, isLoading: false, attachments: [], challenge: null, failedToLoad: true, errorMessage: _.get(action, 'error.response.data.message', '') }
case LOAD_CHALLENGE_DETAILS_SUCCESS: {
const phases = action.payload.phases
const swapPhaseAtIndex = (phaseA, phaseB) => {
const phaseAIndex = _.findIndex(phases, { name: phaseA })
let phaseBIndex = _.findIndex(phases, { name: phaseB })
if (phaseAIndex >= 0 && phaseBIndex >= 0) {
const tmp = phases[phaseAIndex]
phases.splice(phaseAIndex, 1)
phaseBIndex = _.findIndex(phases, { name: phaseB })
phases.splice(phaseBIndex, 0, tmp)
}
}
swapPhaseAtIndex('Checkpoint Submission', 'Submission')
swapPhaseAtIndex('Checkpoint Screening', 'Submission')
swapPhaseAtIndex('Checkpoint Review', 'Submission')

return {
...state,
challengeDetails: { ...action.payload,
Expand Down

0 comments on commit 263b20f

Please sign in to comment.