diff --git a/src/shared/components/SubmissionPage/Submit/index.jsx b/src/shared/components/SubmissionPage/Submit/index.jsx index eecbb02195..b1d6e18ad6 100644 --- a/src/shared/components/SubmissionPage/Submit/index.jsx +++ b/src/shared/components/SubmissionPage/Submit/index.jsx @@ -61,14 +61,16 @@ class Submit extends React.Component { getSubDetails() { const { currentPhases, + allPhases, } = this.props; - const checkpoint = _.find(currentPhases, { + const statusPhases = (currentPhases && currentPhases.length > 0 ? currentPhases : allPhases); + const checkpoint = _.find(statusPhases, { phaseType: 'Checkpoint Submission', }); - const submission = _.find(currentPhases, { + const submission = _.find(statusPhases, { phaseType: 'Submission', }); - const finalFix = _.find(currentPhases, { + const finalFix = _.find(statusPhases, { phaseType: 'Final Fix', }); let subType; @@ -365,6 +367,7 @@ const filestackDataProp = PT.shape({ */ Submit.propTypes = { currentPhases: PT.arrayOf(PT.object).isRequired, + allPhases: PT.arrayOf(PT.object).isRequired, userId: PT.string.isRequired, challengeId: PT.number.isRequired, challengeName: PT.string.isRequired, diff --git a/src/shared/components/SubmissionPage/index.jsx b/src/shared/components/SubmissionPage/index.jsx index 412938b756..b0dd3aa986 100644 --- a/src/shared/components/SubmissionPage/index.jsx +++ b/src/shared/components/SubmissionPage/index.jsx @@ -27,7 +27,7 @@ function SubmissionsPage(props) { const submissionEnded = status === 'COMPLETED' || (!_.some(currentPhases, { phaseType: 'Submission', phaseStatus: 'Open' }) - && !_.some(currentPhases, { phaseType: 'Checkpoint Submission', phaseStatus: 'Open' })); + && !_.some(currentPhases, { phaseType: 'Checkpoint Submission', phaseStatus: 'Open' })); const hasFirstPlacement = !_.isEmpty(winners) && _.some(winners, { placement: 1, handle }); @@ -109,6 +109,7 @@ SubmissionsPage.propTypes = { winners: PT.arrayOf(PT.object).isRequired, handle: PT.string.isRequired, currentPhases: PT.arrayOf(PT.object).isRequired, + allPhases: PT.arrayOf(PT.object).isRequired, }; export default SubmissionsPage; diff --git a/src/shared/containers/SubmissionPage.jsx b/src/shared/containers/SubmissionPage.jsx index 3ff1f9c756..6c0a2790f6 100644 --- a/src/shared/containers/SubmissionPage.jsx +++ b/src/shared/containers/SubmissionPage.jsx @@ -40,7 +40,7 @@ class SubmissionsPageContainer extends React.Component { // and the communitiesList is not up-to-date // then will load the communitiesList if (!_.isEmpty(groups) && !communitiesList.loadingUuid - && (Date.now() - communitiesList.timestamp > 10 * MIN)) { + && (Date.now() - communitiesList.timestamp > 10 * MIN)) { getCommunitiesList(auth); } } @@ -152,6 +152,7 @@ const mapStateToProps = (state, ownProps) => { return { auth: state.auth, currentPhases: state.challenge.details.currentPhases, + allPhases: state.challenge.details.allPhases, communitiesList: state.tcCommunities.list, /* Older stuff below. */ userId: state.auth.user.userId,