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
Generated
+10
@@ -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/
|
||||
Generated
+9
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="jbr-25" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/brainwave.iml" filepath="$PROJECT_DIR$/.idea/brainwave.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -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