Skip to content

Issue 4723: Fixed Deadline Panel date issue #4732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function DeadlinesPanel({ deadlines }) {
{ deadlines.map((d, index) => (
<Card
key={d.name}
time={d.actualEndDate || d.scheduledEndDate}
time={d.scheduledEndDate || d.actualEndDate}
title={index === deadlines.length - 1 ? 'Winners' : d.name}
/>
))}
Expand Down
19 changes: 11 additions & 8 deletions src/shared/components/challenge-detail/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ export default function ChallengeHeader(props) {
reliabilityBonus,
numOfRegistrants,
numOfSubmissions,
appealsEndDate,
endDate,
status,
type,
track,
} = challenge;

const tags = challenge.tags || [];
const appealsEndDate = endDate;

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

let nextPhase = allPhases.filter(p => p.name !== 'Registration' && p.isOpen).sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
let nextPhase = allPhases.filter(p => p.isOpen)
.sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
if (hasRegistered && allPhases[0] && allPhases[0].name === 'Registration') {
nextPhase = allPhases[1] || {};
}
Expand Down Expand Up @@ -164,8 +166,8 @@ export default function ChallengeHeader(props) {
if (b.name.toLowerCase().includes('registration')) {
return 1;
}
return (new Date(a.actualEndDate || a.scheduledEndDate)).getTime()
- (new Date(b.actualEndDate || b.scheduledEndDate)).getTime();
return (new Date(a.scheduledEndDate || a.actualEndDate)).getTime()
- (new Date(b.scheduledEndDate || b.actualEndDate)).getTime();
});
if (type === 'First2Finish' && status === 'Completed') {
const phases2 = allPhases.filter(p => p.name === 'Iterative Review' && !p.isOpen);
Expand All @@ -174,19 +176,20 @@ export default function ChallengeHeader(props) {
|| new Date(p.scheduledEndDate).getTime() < endPhaseDate));
relevantPhases.push({
id: -1,
phaseType: 'Winners',
name: 'Winners',
scheduledEndDate: endPhaseDate,
});
} else if (relevantPhases.length > 1 && appealsEndDate) {
} else if (relevantPhases.length > 1) {
const lastPhase = relevantPhases[relevantPhases.length - 1];
const lastPhaseTime = (
new Date(lastPhase.actualEndDate || lastPhase.scheduledEndDate)
).getTime();

const appealsEnd = (new Date(appealsEndDate).getTime());
if (lastPhaseTime < appealsEnd) {
relevantPhases.push({
id: -1,
phaseType: 'Winners',
name: 'Winners',
scheduledEndDate: appealsEndDate,
});
}
Expand Down Expand Up @@ -488,7 +491,7 @@ ChallengeHeader.propTypes = {
numOfRegistrants: PT.any,
numOfSubmissions: PT.any,
status: PT.any,
appealsEndDate: PT.any,
endDate: PT.any,
phases: PT.any,
roundId: PT.any,
prizeSets: PT.any,
Expand Down