Skip to content

Commit 25754fe

Browse files
authored
Merge pull request #1586 from topcoder-platform/develop
PROD HOTFIX - Handle strings or booleans for `show_data_dashboard` flag
2 parents 26274ce + 5d69c67 commit 25754fe

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

.circleci/config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ install_dependency: &install_dependency
2222
sudo apt update
2323
sudo apt install python3-pip
2424
sudo pip3 install awscli --upgrade
25+
sudo pip3 install docker==6.1.3
2526
sudo pip3 install docker-compose
2627
2728
install_test_dependency: &install_test_dependency
@@ -152,7 +153,7 @@ workflows:
152153
context : org-global
153154
filters: &filters-dev
154155
branches:
155-
only: ['develop', 'multiround', 'release_0.20.9']
156+
only: ['develop', 'multiround', 'release_0.20.9', 'metadata-fix']
156157

157158
# Production builds are exectuted only on tagged commits to the
158159
# master branch.

src/components/ChallengeEditor/ChallengeView/index.js

+3-1
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
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

+9-2
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 }
1072+
useDashboard = { name: 'show_data_dashboard', value: 'false' }
1073+
} else if (_.isBoolean(useDashboard.value)) {
1074+
useDashboard = { name: 'show_data_dashboard', value: _.toString(useDashboard.value) }
10731075
}
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+
const useDashboard = useDashboardData
1654+
? (_.isString(useDashboardData.value) && useDashboardData.value === 'true') ||
1655+
(_.isBoolean(useDashboardData.value) && useDashboardData.value) : false
1656+
16501657
const workTypes = getDomainTypes(challenge.trackId)
16511658
const filteredTypes = metadata.challengeTypes.filter(type => workTypes.includes(type.abbreviation))
16521659

src/util/date.js

+10
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,15 @@ export const updateChallengePhaseBeforeSendRequest = (challengeDetail) => {
198198
}))
199199
return challengeDetailTmp
200200
}
201+
if (challengeDetail.metadata && challengeDetail.metadata.length > 0) {
202+
challengeDetail.metadata = challengeDetail.metadata.map(m => {
203+
// check if value is boolean and convert to string
204+
if (typeof m.value === 'boolean') {
205+
m.value = m.value.toString()
206+
}
207+
208+
return m
209+
})
210+
}
201211
return challengeDetail
202212
}

0 commit comments

Comments
 (0)