From 9b1d2b4f4b72448110e4122fd0ed32ee611f3ff3 Mon Sep 17 00:00:00 2001 From: JohanGrims Date: Wed, 18 Dec 2024 21:25:37 +0100 Subject: [PATCH] Refactor Match component to simplify choice filtering by removing unnecessary string conversions --- src/admin/vote/Match.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/admin/vote/Match.tsx b/src/admin/vote/Match.tsx index 791aad4..6d15201 100644 --- a/src/admin/vote/Match.tsx +++ b/src/admin/vote/Match.tsx @@ -59,30 +59,28 @@ export default function Match() { { choices.filter( (choice) => - choice.listIndex === - s.listIndex.toString() && - choice.grade === c.grade.toString() + choice.listIndex == s.listIndex && + choice.grade == c.grade )[0]?.name } {choices.filter( (choice) => - choice.listIndex === s.listIndex.toString() && - choice.grade === c.grade.toString() + choice.listIndex == s.listIndex && + choice.grade == c.grade ).length > 1 && " + " + (choices.filter( (choice) => - choice.listIndex === - s.listIndex.toString() && - choice.grade === c.grade.toString() + choice.listIndex == s.listIndex && + choice.grade == c.grade ).length - 1) + " weitere"} {choices.filter( (choice) => - choice.listIndex === s.listIndex.toString() && - choice.grade === c.grade.toString() + choice.listIndex == s.listIndex && + choice.grade == c.grade ).length < 1 && (