diff --git a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx index b8d17827d..fef4ed762 100644 --- a/src/shared/components/challenge-detail/Specification/SideBar/index.jsx +++ b/src/shared/components/challenge-detail/Specification/SideBar/index.jsx @@ -18,12 +18,10 @@ import styles from './styles.scss'; export default function SideBar({ challengesUrl, legacyId, - documents, eventDetail, // shareable, forumLink, discuss, - hasRegistered, reviewType, isDesign, terms, @@ -116,29 +114,6 @@ export default function SideBar({ return (
- { - hasRegistered && documents && documents.length > 0 && ( -
-

- DOWNLOADS: -

-
    - { - documents.map((doc) => { - const url = `${config.URL.COMMUNITY}/tc?module=DownloadDocument&docid=${doc.documentId}`; - return ( -
  • - - {doc.documentName} - -
  • - ); - }) - } -
-
- ) - }

Learn @@ -518,8 +493,6 @@ export default function SideBar({ SideBar.defaultProps = { eventDetail: null, discuss: [], - documents: undefined, - hasRegistered: false, reviewType: 'COMMUNITY', isDesign: false, terms: [], @@ -541,11 +514,9 @@ SideBar.propTypes = { eventName: PT.string.isRequired, description: PT.string.isRequired, }), - documents: PT.arrayOf(PT.shape()), // shareable: PT.bool.isRequired, forumLink: PT.string.isRequired, discuss: PT.arrayOf(PT.shape()), - hasRegistered: PT.bool, reviewType: PT.string, isDesign: PT.bool, terms: PT.arrayOf(PT.shape()), diff --git a/src/shared/components/challenge-detail/Specification/index.jsx b/src/shared/components/challenge-detail/Specification/index.jsx index 831e4e80b..73cf3c1d8 100644 --- a/src/shared/components/challenge-detail/Specification/index.jsx +++ b/src/shared/components/challenge-detail/Specification/index.jsx @@ -28,7 +28,6 @@ export default function ChallengeDetailsView(props) { const { communitiesList, terms, - hasRegistered, challenge, challengesUrl, savingChallenge, @@ -44,7 +43,6 @@ export default function ChallengeDetailsView(props) { descriptionFormat, legacy, legacyId, - documents, userDetails, metadata, events, @@ -365,8 +363,6 @@ export default function ChallengeDetailsView(props) { legacyId={legacyId} forumLink={forumLink} discuss={discuss} - documents={documents} - hasRegistered={hasRegistered} isDesign={track.toLowerCase() === 'design'} isDevelop={track.toLowerCase() === 'development'} eventDetail={_.isEmpty(events) ? null : events[0]} @@ -406,7 +402,6 @@ ChallengeDetailsView.defaultProps = { ChallengeDetailsView.propTypes = { terms: PT.arrayOf(PT.shape()), - hasRegistered: PT.bool.isRequired, challenge: PT.shape({ description: PT.string, descriptionFormat: PT.string, diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index 6e6416105..127d4c87f 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -102,6 +102,31 @@ class SubmissionsComponent extends React.Component { } } + /** + * Returns the value of the "Initial Score" shown on the submissions tab + * We have to check a couple things because sometimes we're running code challenges that + * likely should be marathon matches (PS-295) + * + * Marathon matches place the initial score in submission.score + * + * Code challenges place the initial score in submission.review[x].score + * + * We need to check both places + * @param {Object} submission The submission to return the score for + */ + getInitialScore(submission) { + let score = 'N/A'; + if (!_.isEmpty(submission.review) + && !_.isEmpty(submission.review[0]) + && submission.review[0].score + && this.challenge.status === 'Completed') { + score = Number(submission.review[0].score).toFixed(2); + } else if (!_.isEmpty(submission.score)) { + score = Number(submission.score).toFixed(2); + } + return score; + } + /** * Check if it have flag for first try * @param {Object} registrant registrant info @@ -209,6 +234,10 @@ class SubmissionsComponent extends React.Component { if (isHaveFinalScore) { valueA = getFinalScore(a); valueB = getFinalScore(b); + } else if (valueA.score || valueB.score) { + // Handle MM formatted scores in a code challenge (PS-295) + valueA = Number(valueA.score); + valueB = Number(valueB.score); } else { valueA = !_.isEmpty(a.review) && a.review[0].score; valueB = !_.isEmpty(b.review) && b.review[0].score; @@ -904,11 +933,7 @@ class SubmissionsComponent extends React.Component {
INITIAL SCORE

- { - (!_.isEmpty(s.review) && !_.isEmpty(s.review[0]) && s.review[0].score && challenge.status === 'Completed') - ? Number(s.review[0].score).toFixed(2) - : 'N/A' - } + {this.getInitialScore(s)}