diff --git a/src/js/app/challenge-details/js/controllers/challenge-details-controller.js b/src/js/app/challenge-details/js/controllers/challenge-details-controller.js index 7a0d48da..4aadafff 100644 --- a/src/js/app/challenge-details/js/controllers/challenge-details-controller.js +++ b/src/js/app/challenge-details/js/controllers/challenge-details-controller.js @@ -450,7 +450,7 @@ // top section if (vm.challenge.reviewType == 'PEER') { - vm.phaseProgram = getPhaseProgramDetail(challenge.currentPhaseName); + vm.phaseProgram = getPhaseProgramDetail(challenge.currentPhaseName, challenge.currentStatus); } } @@ -460,8 +460,10 @@ * * @param phase name of the phase for which the details are to be prepared */ - function getPhaseProgramDetail(phase) { - if (phase === 'Draft') { + function getPhaseProgramDetail(phase, status) { + status = status.toLowerCase(); + phase = phase.trim().toLowerCase(); + if (status === 'draft' || !phase || phase.trim().length == 0 || phase === 'draft') { return { nextStepTitle: "What's Next?", nextStepDescription: "Hold tight. This challenge will be starting soon.", @@ -469,7 +471,7 @@ nextBadgeImg: "/mf/i/member-program/missions/get-ready/level-5-512.png", nextBadgeTitle: "Next badge" }; - } else if (phase === 'Registration') { + } else if (status === 'active' && phase === 'registration') { return { nextStepTitle: "What's Next?", nextStepDescription: "Register to participate by clicking the Register button. Then when you're ready, click Submit to upload your submission. Keep an eye on the time limit!", @@ -477,7 +479,7 @@ nextBadgeImg: "/mf/i/member-program/missions/get-ready/level-5-512.png", nextBadgeTitle: "Step One" }; - } else if (phase === 'Submission') { + } else if (status === 'active' && phase === 'submission') { return { nextStepTitle: "What's Next?", nextStepDescription: "Submit to upload your submission. Keep an eye on the time limit!", @@ -485,7 +487,7 @@ nextBadgeImg: "/mf/i/member-program/missions/get-ready/level-5-512.png", nextBadgeTitle: "Getting Ready" }; - } else if (phase === 'Review') { + } else if (status === 'active' && phase === 'review') { return { nextStepTitle: "What's Next?", nextStepDescription: "If you got your submission uploaded in time, then it's time to review your peers.", @@ -493,6 +495,14 @@ nextBadgeImg: "/mf/i/member-program/missions/get-ready/level-5-512.png", nextBadgeTitle: "Break the Finish" }; + } else if (status === 'completed' || status.indexOf('cancelled') != -1) { + return { + nextStepTitle: "What's Next?", + nextStepDescription: "This challenge has completed.", + nextStepAction: "", + nextBadgeImg: "/mf/i/member-program/missions/get-ready/level-5-512.png", + nextBadgeTitle: "Break the Finish" + }; } else { // for default show only badge return { nextStepTitle: "",