From a36a464bc2d0750f51859cb8a06d8360988bb19b Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 15 Dec 2023 09:41:54 +1100 Subject: [PATCH] Handle the show_data_dashboard flag as string or boolean --- .../ChallengeEditor/ChallengeView/index.js | 4 +++- src/components/ChallengeEditor/index.js | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/ChallengeEditor/ChallengeView/index.js b/src/components/ChallengeEditor/ChallengeView/index.js index 1ae5aea7..8018e6a1 100644 --- a/src/components/ChallengeEditor/ChallengeView/index.js +++ b/src/components/ChallengeEditor/ChallengeView/index.js @@ -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 (
diff --git a/src/components/ChallengeEditor/index.js b/src/components/ChallengeEditor/index.js index 6d4f6a74..60e08de7 100644 --- a/src/components/ChallengeEditor/index.js +++ b/src/components/ChallengeEditor/index.js @@ -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 { @@ -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))