File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,12 @@ export default function ChallengeHeader(props) {
66
66
events,
67
67
legacy,
68
68
prizeSets,
69
- currentPhases,
70
69
reliabilityBonus,
71
70
userDetails,
72
71
numRegistrants,
73
72
numSubmissions,
74
73
appealsEndDate,
74
+ status,
75
75
} = challenge ;
76
76
77
77
const { track } = legacy ;
@@ -80,7 +80,6 @@ export default function ChallengeHeader(props) {
80
80
81
81
const allPhases = challenge . phases || [ ] ;
82
82
const { prizes } = prizeSets && prizeSets . length ? prizeSets [ 0 ] : [ ] ;
83
- const status = allPhases . length ? allPhases [ 0 ] . name : '' ;
84
83
85
84
const checkpointPrizes = _ . find ( prizeSets , { type : 'checkpoint' } ) ;
86
85
let numberOfCheckpointsPrizes = 0 ;
@@ -126,8 +125,8 @@ export default function ChallengeHeader(props) {
126
125
*/
127
126
const hasSubmissions = userDetails && ( userDetails . submissions || [ ] ) . reduce ( ( acc , submission ) => acc || submission . status !== 'Deleted' , false ) ;
128
127
129
- let nextPhase = ( currentPhases && currentPhases [ 0 ] ) || { } ;
130
- 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 && allPhases . name === 'Registration' ) {
131
130
nextPhase = allPhases [ 1 ] || { } ;
132
131
}
133
132
const nextDeadline = nextPhase && nextPhase . name ;
You can’t perform that action at this time.
0 commit comments