Skip to content

Added !isEmpty check before call phaseStartDate and phaseEndDate #4915

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
Sep 14, 2020
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 @@ -101,13 +101,13 @@ function Tip(props) {
const submissionPhase = allPhases.find(phase => phase.name === 'Submission') || {};
const checkpointPhase = allPhases.find(phase => phase.name === 'Checkpoint Submission') || {};

if (registrationPhase) {
if (!_.isEmpty(registrationPhase)) {
steps.push({
date: phaseStartDate(registrationPhase),
name: 'Start',
});
}
if (checkpointPhase) {
if (!_.isEmpty(checkpointPhase)) {
steps.push({
date: phaseEndDate(checkpointPhase),
name: 'Checkpoint',
Expand All @@ -119,7 +119,7 @@ function Tip(props) {
date: phaseEndDate(iterativeReviewPhase),
name: 'Iterative Review',
});
} else if (submissionPhase) {
} else if (!_.isEmpty(submissionPhase)) {
steps.push({
date: phaseEndDate(submissionPhase),
name: 'Submission',
Expand Down
4 changes: 2 additions & 2 deletions src/shared/utils/challenge-listing/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import moment from 'moment';
import { find, sumBy } from 'lodash';
import { find, sumBy, isEmpty } from 'lodash';
import { phaseStartDate, phaseEndDate } from './helper';

export const SORTS = {
Expand Down Expand Up @@ -59,7 +59,7 @@ export default {
const registrationPhase = find(challenge.phases, p => p.name === 'Registration') || {};
const submissionPhase = find(challenge.phases, p => p.name === 'Submission') || {};
// registration phase exists
if (registrationPhase) {
if (!isEmpty(registrationPhase)) {
return moment(phaseStartDate(registrationPhase));
}
// registration phase doesnt exist, This is possibly a F2F or TSK. Take submission phase
Expand Down