fix: don't send loop over not voted answers

This commit is contained in:
CyberL1
2026-06-25 08:30:13 +02:00
committed by Rory&
parent 97285d545c
commit 68ee917ccf
@@ -75,7 +75,7 @@ router.put("/", route({ requestBody: "PollUserAnswersSchema", permission: "VIEW_
}
}
for (const answerCount of allAnswerCounts.filter((a) => !payload.answer_ids.includes(a.id))) {
for (const answerCount of allAnswerCounts.filter((a) => !payload.answer_ids.includes(a.id) && a.voters.includes(req.user_id))) {
answerCount.voters = answerCount.voters.filter((voter) => voter != req.user_id);
answerCount.count = answerCount.voters.length;