feat: erweitere _extractTrainerVocabsFromExercises um Optionen zur Steuerung von Lückenfüllungen
All checks were successful
Deploy to production / deploy (push) Successful in 1m58s
All checks were successful
Deploy to production / deploy (push) Successful in 1m58s
This commit is contained in:
@@ -777,7 +777,8 @@ export default class VocabService {
|
||||
return {};
|
||||
}
|
||||
|
||||
_extractTrainerVocabsFromExercises(exercises = []) {
|
||||
_extractTrainerVocabsFromExercises(exercises = [], options = {}) {
|
||||
const { allowGapFill = true } = options || {};
|
||||
const vocabMap = new Map();
|
||||
|
||||
exercises.forEach((exercise) => {
|
||||
@@ -813,6 +814,7 @@ export default class VocabService {
|
||||
}
|
||||
|
||||
if (exerciseType === 'gap_fill') {
|
||||
if (!allowGapFill) return;
|
||||
const answers = Array.isArray(aData.answers)
|
||||
? aData.answers
|
||||
: (aData.correct ? (Array.isArray(aData.correct) ? aData.correct : [aData.correct]) : []);
|
||||
@@ -2670,7 +2672,7 @@ export default class VocabService {
|
||||
if (plainLesson.weekNumber) {
|
||||
try {
|
||||
const weekExercises = await this._getWeekVocabExercises(plainLesson.courseId, plainLesson.weekNumber, plainLesson.lessonNumber);
|
||||
const extracted = this._extractTrainerVocabsFromExercises(weekExercises || []);
|
||||
const extracted = this._extractTrainerVocabsFromExercises(weekExercises || [], { allowGapFill: false });
|
||||
if (extracted && extracted.length) {
|
||||
// Map extracted pairs to row-like objects with numeric ids
|
||||
rows = extracted.map((item, idx) => ({ id: 2000000 + idx, learning: item.learning, reference: item.reference }));
|
||||
|
||||
Reference in New Issue
Block a user