Skip to content

Commit ac08421

Browse files
committed
fix: support float values for prizes
ref issue #1074
1 parent a91f419 commit ac08421

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/components/ChallengeEditor/ChallengeTotal-Field/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const ChallengeTotalField = ({ challenge }) => {
1111
challengeTotal = _.flatten(challenge.prizeSets.map(p => p.prizes))
1212
.map(p => p.value)
1313
.map(v => convertDollarToInteger(v, '$'))
14-
.map(v => +v)
1514
.reduce((prev, next) => prev + next, 0)
1615
}
1716
return (

src/util/input-check.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const validateValue = (value, checkType = '', prefix = '') => {
4444
*/
4545
export const convertDollarToInteger = (value, prefix = '') => {
4646
if (value) {
47-
return parseInt(('' + value).replace(prefix, '').replace(' ', '').replace(/[^0-9]/g, ''))
47+
return parseInt(('' + value).replace(prefix, '').replace(' ', '').replace(/[^0-9.,]/g, ''))
4848
}
4949
return 0
5050
}

0 commit comments

Comments
 (0)