0๐
โ
If you need the exact same query on unfiltered data:
countResponses(this.totalQuizResponses);
function countResponses(quizData) {
let counter = 0;
for (const quizResponseA of quizData) {
for (const quizResponseB of quizData) {
if (quizResponseA === quizResponseB) { continue; }
const isSameAnswerKey = quizResponseA.answerKey === quicResponseB.answerKey;
const isSameQuizId = quizResponseA.QuizId === quizResponseB.QuizId;
const isSameUser = quizResponseA.UserId === quizResponseB.UserId;
if (isSameAnswerKey && isSameQuizzId && isSameUser) {
counter++;
}
}
}
return counter;
}
If you already filtered your data with the same query, this.totalQuizResponses.length
is the same as a counter for all the data you have locally
Source:stackexchange.com