Skip to content

Commit 6fa4a47

Browse files
authored
Merge pull request #4732 from nursoltan-s/iss-4723
Issue 4723: Fixed Deadline Panel date issue
2 parents 9d8813a + e73c224 commit 6fa4a47

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function DeadlinesPanel({ deadlines }) {
2929
{ deadlines.map((d, index) => (
3030
<Card
3131
key={d.name}
32-
time={d.actualEndDate || d.scheduledEndDate}
32+
time={d.scheduledEndDate || d.actualEndDate}
3333
title={index === deadlines.length - 1 ? 'Winners' : d.name}
3434
/>
3535
))}

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

+11-8
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ export default function ChallengeHeader(props) {
6767
reliabilityBonus,
6868
numOfRegistrants,
6969
numOfSubmissions,
70-
appealsEndDate,
70+
endDate,
7171
status,
7272
type,
7373
track,
7474
} = challenge;
7575

7676
const tags = challenge.tags || [];
77+
const appealsEndDate = endDate;
7778

7879
const allPhases = challenge.phases || [];
7980
const { prizes } = prizeSets && prizeSets.length ? prizeSets[0] : [];
@@ -119,7 +120,8 @@ export default function ChallengeHeader(props) {
119120
*/
120121
const hasSubmissions = !_.isEmpty(mySubmissions);
121122

122-
let nextPhase = allPhases.filter(p => p.name !== 'Registration' && p.isOpen).sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
123+
let nextPhase = allPhases.filter(p => p.isOpen)
124+
.sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
123125
if (hasRegistered && allPhases[0] && allPhases[0].name === 'Registration') {
124126
nextPhase = allPhases[1] || {};
125127
}
@@ -164,8 +166,8 @@ export default function ChallengeHeader(props) {
164166
if (b.name.toLowerCase().includes('registration')) {
165167
return 1;
166168
}
167-
return (new Date(a.actualEndDate || a.scheduledEndDate)).getTime()
168-
- (new Date(b.actualEndDate || b.scheduledEndDate)).getTime();
169+
return (new Date(a.scheduledEndDate || a.actualEndDate)).getTime()
170+
- (new Date(b.scheduledEndDate || b.actualEndDate)).getTime();
169171
});
170172
if (type === 'First2Finish' && status === 'Completed') {
171173
const phases2 = allPhases.filter(p => p.name === 'Iterative Review' && !p.isOpen);
@@ -174,19 +176,20 @@ export default function ChallengeHeader(props) {
174176
|| new Date(p.scheduledEndDate).getTime() < endPhaseDate));
175177
relevantPhases.push({
176178
id: -1,
177-
phaseType: 'Winners',
179+
name: 'Winners',
178180
scheduledEndDate: endPhaseDate,
179181
});
180-
} else if (relevantPhases.length > 1 && appealsEndDate) {
182+
} else if (relevantPhases.length > 1) {
181183
const lastPhase = relevantPhases[relevantPhases.length - 1];
182184
const lastPhaseTime = (
183185
new Date(lastPhase.actualEndDate || lastPhase.scheduledEndDate)
184186
).getTime();
187+
185188
const appealsEnd = (new Date(appealsEndDate).getTime());
186189
if (lastPhaseTime < appealsEnd) {
187190
relevantPhases.push({
188191
id: -1,
189-
phaseType: 'Winners',
192+
name: 'Winners',
190193
scheduledEndDate: appealsEndDate,
191194
});
192195
}
@@ -488,7 +491,7 @@ ChallengeHeader.propTypes = {
488491
numOfRegistrants: PT.any,
489492
numOfSubmissions: PT.any,
490493
status: PT.any,
491-
appealsEndDate: PT.any,
494+
endDate: PT.any,
492495
phases: PT.any,
493496
roundId: PT.any,
494497
prizeSets: PT.any,

0 commit comments

Comments
 (0)