Skip to content

Commit

Permalink
Refactor Match component to simplify choice filtering by removing unn…
Browse files Browse the repository at this point in the history
…ecessary string conversions
  • Loading branch information
JohanGrims committed Dec 18, 2024
1 parent cb37727 commit 9b1d2b4
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/admin/vote/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
</Link>
{choices.filter(
(choice) =>
choice.listIndex === s.listIndex.toString() &&
choice.grade === c.grade.toString()
choice.listIndex == s.listIndex &&
choice.grade == c.grade
).length < 1 && (
<Link
to={`../add?name=${s.name}&grade=${c.grade}&listIndex=${s.listIndex}`}
Expand Down

0 comments on commit 9b1d2b4

Please sign in to comment.