fix player input parsing for coding contracts that accept arrays of strings (#937)

This commit is contained in:
Collin Pearce 2024-01-02 06:26:34 -08:00 committed by GitHub
parent 8742df9588
commit 0da9d9d3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1162,7 +1162,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
const sanitizedPlayerAns: string = removeBracketsFromArrayString(ans);
const sanitizedPlayerAnsArr: string[] = sanitizedPlayerAns.split(",");
for (let i = 0; i < sanitizedPlayerAnsArr.length; ++i) {
sanitizedPlayerAnsArr[i] = removeQuotesFromString(sanitizedPlayerAnsArr[i]).replace(/\s/g, "");
sanitizedPlayerAnsArr[i] = removeQuotesFromString(sanitizedPlayerAnsArr[i].replace(/\s/g, ""));
}
if (sanitizedPlayerAnsArr.length !== res.length) {
@ -1264,7 +1264,7 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
// Don't include any "" entries in the parsed array
const sanitizedPlayerAnsArr: string[] = filterTruthy(sanitizedPlayerAns.split(","));
for (let i = 0; i < sanitizedPlayerAnsArr.length; ++i) {
sanitizedPlayerAnsArr[i] = removeQuotesFromString(sanitizedPlayerAnsArr[i]).replace(/\s/g, "");
sanitizedPlayerAnsArr[i] = removeQuotesFromString(sanitizedPlayerAnsArr[i].replace(/\s/g, ""));
}
if (num == null || num.length === 0) {