Skip to content

Commit 8cd67dc

Browse files
authored
Merge pull request #4506 from rashmi73/issue_4499
Issue 4499 fix
2 parents 0632425 + 9e1a8e7 commit 8cd67dc

File tree

1 file changed

+3
-3
lines changed
  • src/shared/components/challenge-detail/Header

1 file changed

+3
-3
lines changed

src/shared/components/challenge-detail/Header/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default function ChallengeHeader(props) {
7171
numRegistrants,
7272
numSubmissions,
7373
appealsEndDate,
74+
status,
7475
} = challenge;
7576

7677
const { track } = legacy;
@@ -79,7 +80,6 @@ export default function ChallengeHeader(props) {
7980

8081
const allPhases = challenge.phases || [];
8182
const { prizes } = prizeSets && prizeSets.length ? prizeSets[0] : [];
82-
const status = allPhases.length ? allPhases[0].name : '';
8383

8484
const checkpointPrizes = _.find(prizeSets, { type: 'checkpoint' });
8585
let numberOfCheckpointsPrizes = 0;
@@ -125,8 +125,8 @@ export default function ChallengeHeader(props) {
125125
*/
126126
const hasSubmissions = userDetails && (userDetails.submissions || []).reduce((acc, submission) => acc || submission.status !== 'Deleted', false);
127127

128-
let nextPhase = (allPhases && allPhases[0]) || {};
129-
if (hasRegistered && nextPhase && nextPhase.name === 'Registration') {
128+
let nextPhase = allPhases.filter(p => p.name !== 'Registration' && p.isOpen).sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
129+
if (hasRegistered && allPhases[0] && allPhases[0].name === 'Registration') {
130130
nextPhase = allPhases[1] || {};
131131
}
132132
const nextDeadline = nextPhase && nextPhase.name;

0 commit comments

Comments
 (0)