Added listening import, part divider was showing between questions because it was with exerciseIndex instead of partIndex, fixed a reorder bug when deleting questions
This commit is contained in:
@@ -3,14 +3,14 @@ import { ModuleState } from "../types";
|
||||
import ReorderResult from "./types";
|
||||
|
||||
const reorderFillBlanks = (exercise: FillBlanksExercise, startId: number): ReorderResult<FillBlanksExercise> => {
|
||||
let idMapping = exercise.solutions
|
||||
let idMapping = [...exercise.solutions]
|
||||
.sort((a, b) => parseInt(a.id) - parseInt(b.id))
|
||||
.reduce((acc, solution, index) => {
|
||||
acc[solution.id] = (startId + index).toString();
|
||||
return acc;
|
||||
}, {} as Record<string, string>);
|
||||
|
||||
let newSolutions = exercise.solutions
|
||||
let newSolutions = [...exercise.solutions]
|
||||
.sort((a, b) => parseInt(a.id) - parseInt(b.id))
|
||||
.map((solution, index) => ({
|
||||
...solution,
|
||||
@@ -84,7 +84,7 @@ const reorderWriteBlanks = (exercise: WriteBlanksExercise, startId: number): Reo
|
||||
};
|
||||
|
||||
const reorderTrueFalse = (exercise: TrueFalseExercise, startId: number): ReorderResult<TrueFalseExercise> => {
|
||||
let newQuestions = exercise.questions
|
||||
let newQuestions = [...exercise.questions]
|
||||
.sort((a, b) => parseInt(a.id) - parseInt(b.id))
|
||||
.map((question, index) => ({
|
||||
...question,
|
||||
@@ -101,7 +101,7 @@ const reorderTrueFalse = (exercise: TrueFalseExercise, startId: number): Reorder
|
||||
};
|
||||
|
||||
const reorderMatchSentences = (exercise: MatchSentencesExercise, startId: number): ReorderResult<MatchSentencesExercise> => {
|
||||
let newSentences = exercise.sentences
|
||||
let newSentences = [...exercise.sentences]
|
||||
.sort((a, b) => parseInt(a.id) - parseInt(b.id))
|
||||
.map((sentence, index) => ({
|
||||
...sentence,
|
||||
@@ -119,7 +119,7 @@ const reorderMatchSentences = (exercise: MatchSentencesExercise, startId: number
|
||||
|
||||
|
||||
const reorderMultipleChoice = (exercise: MultipleChoiceExercise, startId: number): ReorderResult<MultipleChoiceExercise> => {
|
||||
let newQuestions = exercise.questions
|
||||
let newQuestions = [...exercise.questions]
|
||||
.sort((a, b) => parseInt(a.id) - parseInt(b.id))
|
||||
.map((question, index) => ({
|
||||
...question,
|
||||
|
||||
Reference in New Issue
Block a user