Public Access
fix: remove stale value check from OrderQuestion initial; guard wrong class in Match
This commit is contained in:
1 parent
e48e37ad87
commit
535bdb5a50
7 files changed
+42
-3
No files matched your search
@@ -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])
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user