Fix Math Expressions contract

Previously player could submit as many wrong answers in the solution as they wanted, as long as all correct answers were included. Fixed by ensuring length matches actual answer.
This commit is contained in:
omuretsu 2023-02-28 09:14:12 -05:00
parent 45ca94b1dc
commit f16246f939

@ -1271,6 +1271,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
const result: string[] = []; const result: string[] = [];
helper(result, "", num, target, 0, 0, 0); helper(result, "", num, target, 0, 0, 0);
// Prevent player from providing extra wrong answers and still receiving credit
if (result.length !== sanitizedPlayerAnsArr.length) return false;
for (const expr of result) { for (const expr of result) {
if (!sanitizedPlayerAnsArr.includes(expr)) { if (!sanitizedPlayerAnsArr.includes(expr)) {