Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a36a464

Browse files
committedDec 14, 2023
Handle the show_data_dashboard flag as string or boolean
1 parent 51b997f commit a36a464

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
 

‎src/components/ChallengeEditor/ChallengeView/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ const ChallengeView = ({
102102
const showCheckpointPrizes = _.get(challenge, 'timelineTemplateId') === MULTI_ROUND_CHALLENGE_TEMPLATE_ID
103103
const isDataScience = challenge.trackId === DS_TRACK_ID
104104
const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' })
105-
const useDashboard = useDashboardData ? (useDashboardData.value === 'true') : false
105+
const useDashboard = useDashboardData ?
106+
(_.isString(useDashboardData.value) && useDashboardData.value === "true") ||
107+
(_.isBoolean(useDashboardData.value) && useDashboardData.value) : false
106108

107109
return (
108110
<div className={styles.wrapper}>

‎src/components/ChallengeEditor/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,11 @@ class ChallengeEditor extends Component {
10691069
}
10701070
let useDashboard = _.find(challengeMetadata, { name: 'show_data_dashboard' })
10711071
if (useDashboard === undefined) {
1072-
useDashboard = { name: 'show_data_dashboard', value: true }
1073-
}
1072+
useDashboard = { name: 'show_data_dashboard', value: "false" }
1073+
} else if(_.isBoolean(useDashboard.value)){
1074+
useDashboard = { name: 'show_data_dashboard', value: _.toString(useDashboard.value) }
1075+
}
1076+
10741077
newChallenge.metadata.push(useDashboard)
10751078
}
10761079
try {
@@ -1646,7 +1649,11 @@ class ChallengeEditor extends Component {
16461649
const showCheckpointPrizes = challenge.timelineTemplateId === MULTI_ROUND_CHALLENGE_TEMPLATE_ID
16471650
const showDashBoard = (challenge.trackId === DS_TRACK_ID && isChallengeType) || (isDevChallenge && isMM)
16481651
const useDashboardData = _.find(challenge.metadata, { name: 'show_data_dashboard' })
1649-
const useDashboard = useDashboardData ? useDashboardData.value : true
1652+
1653+
1654+
const useDashboard = useDashboardData ?
1655+
(_.isString(useDashboardData.value) && useDashboardData.value === "true") ||
1656+
(_.isBoolean(useDashboardData.value) && useDashboardData.value) : false
16501657
const workTypes = getDomainTypes(challenge.trackId)
16511658
const filteredTypes = metadata.challengeTypes.filter(type => workTypes.includes(type.abbreviation))
16521659

0 commit comments

Comments
 (0)
Please sign in to comment.