Merge pull request #1961 from pateljannat/issues-165

fix: misc issues
This commit is contained in:
Jannat Patel
2026-01-01 14:51:58 +05:30
committed by GitHub
2 changed files with 62 additions and 27 deletions

View File

@@ -25,7 +25,7 @@
:required="true"
/>
<ChildTable
v-model="exercise.test_cases"
v-model="testCases.data"
:label="__('Test Cases')"
:columns="testCaseColumns"
:required="true"
@@ -179,9 +179,7 @@ const testCases = createListResource({
fields: ['input', 'expected_output', 'name'],
cache: ['testCases', props.exerciseID],
parent: 'LMS Programming Exercise',
onSuccess(data: TestCase[]) {
exercise.value.test_cases = data
},
orderBy: 'idx',
})
const fetchTestCases = () => {
@@ -200,6 +198,13 @@ const validateTitle = () => {
}
const saveExercise = (close: () => void) => {
exercise.value.test_cases = testCases.data.map(
(tc: TestCase, index: number) => ({
input: tc.input,
expected_output: tc.expected_output,
idx: index + 1,
})
)
validateTitle()
if (props.exerciseID == 'new') createNewExercise(close)
else updateExercise(close)