Last active
February 26, 2021 02:15
-
-
Save stoneboyindc/a9468416600c81d15ce13dcc6b1d4491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkForPlagiarism (answers, textToCheck) { | |
for ( i = 0; i < answers.length; i++) { | |
let studentresponses = answers[i]; | |
if (studentresponses.response.includes(textToCheck) && studentresponses.isEssayQuestion === true) { | |
return true; | |
} | |
} | |
return false; | |
} | |
function checkForPlagiarism(answers, snippet) { | |
let foundAnswer = 0; | |
let result = false; | |
for (let i=0; i<answers.length; i++) { | |
if (answers[i].response.includes(snippet)) { | |
foundAnswer = i; | |
result = true; | |
break; | |
} | |
} | |
if (result && answers[foundAnswer].isEssayQuestion) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got it! The submission was tripping over identifying the snippet in both non essay and essay questions. This pulls all the essay questions into a storage array and then checks those, which removes the non-essay questions all together.
function checkForPlagiarism(answers, snippet) {
let essayArray =[]
for (let i=0; i<answers.length; i++) {
if(answers[i].isEssayQuestion){
essayArray.push(answers[i])
}
}
for (let i = 0; i<essayArray.length; i++){
if (essayArray[i].response.includes(snippet)) {
return true;
}
}
return false;
}