From 535bdb5a504407b601f12672d5e7c1fe82ffd07d Mon Sep 17 00:00:00 2001 From: LaurensBartelds Date: Tue, 21 Apr 2026 21:45:31 +0200 Subject: [PATCH] fix: remove stale value check from OrderQuestion initial; guard wrong class in Match --- .idea/.gitignore | 10 ++++++++++ .idea/brainwave.iml | 9 +++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 7 +++++++ frontend/src/components/questions/Match.tsx | 2 +- frontend/src/components/questions/OrderQuestion.tsx | 3 +-- 7 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/brainwave.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/brainwave.iml b/.idea/brainwave.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/brainwave.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..fe122df --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3490c58 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..8306744 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/frontend/src/components/questions/Match.tsx b/frontend/src/components/questions/Match.tsx index e690314..f811675 100644 --- a/frontend/src/components/questions/Match.tsx +++ b/frontend/src/components/questions/Match.tsx @@ -57,7 +57,7 @@ export default function Match({ q, value, onChange, locked, graded }: Props) { else if (current[item.id]) cls += ' paired' if (graded) { if (answer[item.id] && current[item.id] === answer[item.id]) cls += ' correct' - else if (current[item.id]) cls += ' wrong' + else if (current[item.id] && answer[item.id]) cls += ' wrong' } const pairedRightIdx = current[item.id] ? (q.right ?? []).findIndex((x) => x.id === current[item.id]) diff --git a/frontend/src/components/questions/OrderQuestion.tsx b/frontend/src/components/questions/OrderQuestion.tsx index 00a6323..bb7892e 100644 --- a/frontend/src/components/questions/OrderQuestion.tsx +++ b/frontend/src/components/questions/OrderQuestion.tsx @@ -14,7 +14,6 @@ export default function OrderQuestion({ q, value, onChange, locked, graded }: Pr const items = q.items ?? [] const initial = useMemo(() => { - if (Array.isArray(value) && value.length === items.length) return value const ids = items.map((i) => i.id) const seed = q.id.split('').reduce((a, c) => a + c.charCodeAt(0), 0) const out = [...ids] @@ -58,7 +57,7 @@ export default function OrderQuestion({ q, value, onChange, locked, graded }: Pr className={cls} draggable={!locked} onDragStart={(e) => { setDragIdx(idx); e.dataTransfer.effectAllowed = 'move' }} - onDragOver={(e) => { e.preventDefault(); setOverIdx(idx) }} + onDragOver={(e) => { e.preventDefault(); if (dragIdx !== idx) setOverIdx(idx) }} onDrop={(e) => { e.preventDefault() if (dragIdx != null && dragIdx !== idx) move(dragIdx, idx)