From ff79f9ed14edd29b5fb69e038f2291673e74cc78 Mon Sep 17 00:00:00 2001 From: rashmi73 Date: Sat, 17 Nov 2018 20:24:44 +0530 Subject: [PATCH 1/2] issue_1759 fixed --- src/shared/components/SubmissionPage/Submit/index.jsx | 9 ++++++--- src/shared/components/SubmissionPage/index.jsx | 3 ++- src/shared/containers/SubmissionPage.jsx | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/shared/components/SubmissionPage/Submit/index.jsx b/src/shared/components/SubmissionPage/Submit/index.jsx index eecbb02195..bb6281daaf 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, { + let 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..8d00d1f0fc 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, From 158ee291224a6ae9d6b26abd76b1c5fef8891904 Mon Sep 17 00:00:00 2001 From: rashmi73 Date: Sat, 17 Nov 2018 20:34:13 +0530 Subject: [PATCH 2/2] linting fixed --- src/shared/components/SubmissionPage/Submit/index.jsx | 4 ++-- src/shared/components/SubmissionPage/index.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/components/SubmissionPage/Submit/index.jsx b/src/shared/components/SubmissionPage/Submit/index.jsx index bb6281daaf..b1d6e18ad6 100644 --- a/src/shared/components/SubmissionPage/Submit/index.jsx +++ b/src/shared/components/SubmissionPage/Submit/index.jsx @@ -61,9 +61,9 @@ class Submit extends React.Component { getSubDetails() { const { currentPhases, - allPhases + allPhases, } = this.props; - let statusPhases = (currentPhases && currentPhases.length > 0 ? currentPhases : allPhases); + const statusPhases = (currentPhases && currentPhases.length > 0 ? currentPhases : allPhases); const checkpoint = _.find(statusPhases, { phaseType: 'Checkpoint Submission', }); diff --git a/src/shared/components/SubmissionPage/index.jsx b/src/shared/components/SubmissionPage/index.jsx index 8d00d1f0fc..b0dd3aa986 100644 --- a/src/shared/components/SubmissionPage/index.jsx +++ b/src/shared/components/SubmissionPage/index.jsx @@ -109,7 +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 + allPhases: PT.arrayOf(PT.object).isRequired, }; export default SubmissionsPage;