From 43e8512656e00d23420517d91d71e75b487f982e Mon Sep 17 00:00:00 2001 From: Matthew Grove Date: Sun, 3 Oct 2021 19:20:37 +0100 Subject: [PATCH] Flag typo if input contains correct answer --- functions/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/index.js b/functions/index.js index 7a962fa..74df0c7 100644 --- a/functions/index.js +++ b/functions/index.js @@ -476,7 +476,8 @@ exports.processAnswer = functions.https.onCall((data, context) => { const levDistance = levenshtein(answer, cleansedInputAnswer); if (levDistance <= 1 || answer.length > 5 && levDistance <= 3 || - answer.length > 10 && levDistance <= 4) { + answer.length > 10 && levDistance <= 4 || + cleansedInputAnswer.includes(answers)) { docData.typo = true; transaction.set(progressDocId, docData); typo = true;