Skip to content

Commit

Permalink
Handle the show_data_dashboard flag as string or boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgasper committed Dec 14, 2023
1 parent 51b997f commit a36a464
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/components/ChallengeEditor/ChallengeView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ const ChallengeView = ({
const showCheckpointPrizes = _.get(challenge, 'timelineTemplateId') === MULTI_ROUND_CHALLENGE_TEMPLATE_ID
const isDataScience = challenge.trackId === DS_TRACK_ID
const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' })
const useDashboard = useDashboardData ? (useDashboardData.value === 'true') : false
const useDashboard = useDashboardData ?
(_.isString(useDashboardData.value) && useDashboardData.value === "true") ||
(_.isBoolean(useDashboardData.value) && useDashboardData.value) : false

return (
<div className={styles.wrapper}>
Expand Down
13 changes: 10 additions & 3 deletions src/components/ChallengeEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,11 @@ class ChallengeEditor extends Component {
}
let useDashboard = _.find(challengeMetadata, { name: 'show_data_dashboard' })
if (useDashboard === undefined) {
useDashboard = { name: 'show_data_dashboard', value: true }
}
useDashboard = { name: 'show_data_dashboard', value: "false" }
} else if(_.isBoolean(useDashboard.value)){
useDashboard = { name: 'show_data_dashboard', value: _.toString(useDashboard.value) }
}

newChallenge.metadata.push(useDashboard)
}
try {
Expand Down Expand Up @@ -1646,7 +1649,11 @@ class ChallengeEditor extends Component {
const showCheckpointPrizes = challenge.timelineTemplateId === MULTI_ROUND_CHALLENGE_TEMPLATE_ID
const showDashBoard = (challenge.trackId === DS_TRACK_ID && isChallengeType) || (isDevChallenge && isMM)
const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' })
const useDashboard = useDashboardData ? useDashboardData.value : true


const useDashboard = useDashboardData ?
(_.isString(useDashboardData.value) && useDashboardData.value === "true") ||
(_.isBoolean(useDashboardData.value) && useDashboardData.value) : false
const workTypes = getDomainTypes(challenge.trackId)
const filteredTypes = metadata.challengeTypes.filter(type => workTypes.includes(type.abbreviation))

Expand Down

0 comments on commit a36a464

Please sign in to comment.