Skip to content

fix for issue #4409 #168

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
merged 1 commit into from
May 26, 2020
Merged
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
18 changes: 8 additions & 10 deletions src/utils/challenge/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,18 @@ function filterByReviewOpportunityType(opp, state) {

function filterByStartDate(challenge, state) {
if (!state.startDate) return true;
const submissionPhase = challenge.phases.filter(d => d.name === 'Submission')[0];
if (submissionPhase) {
return moment(state.startDate).isBefore(submissionPhase.scheduledEndDate);
}
return false;
const submissionPhase = (challenge.phases || []).filter(d => d.name === 'Submission')[0];
const submissionEndDate = submissionPhase ? submissionPhase.scheduledEndDate
: challenge.submissionEndDate;
return moment(state.startDate).isBefore(submissionEndDate);
}

function filterByEndDate(challenge, state) {
if (!state.endDate) return true;
const registrationPhase = challenge.phases.filter(d => d.name === 'Registration')[0];
if (registrationPhase) {
return moment(state.endDate).isAfter(registrationPhase.scheduledStartDate);
}
return false;
const registrationPhase = (challenge.phases || []).filter(d => d.name === 'Registration')[0];
const registrationStartDate = registrationPhase ? registrationPhase.scheduledStartDate
: challenge.registrationStartDate;
return moment(state.endDate).isAfter(registrationStartDate);
}

function filterByStarted(challenge, state) {
Expand Down