From d38231b52cbcc6b40825bd4c659509e8fc0e6ce6 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 1 Apr 2026 15:09:15 +0200 Subject: [PATCH] refactor(vocab): improve text normalization consistency in VocabService and VocabLessonView - Enhanced text normalization methods in both VocabService and VocabLessonView to include an additional trim operation, ensuring leading and trailing spaces are removed. - This change improves the consistency and accuracy of text handling across the application, contributing to better user input processing. --- backend/services/vocabService.js | 3 ++- frontend/src/views/social/VocabLessonView.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/services/vocabService.js b/backend/services/vocabService.js index 7ebde2a..7feda36 100644 --- a/backend/services/vocabService.js +++ b/backend/services/vocabService.js @@ -346,7 +346,8 @@ export default class VocabService { .trim() .toLowerCase() .replace(/[\p{P}]+/gu, ' ') - .replace(/\s+/g, ' '); + .replace(/\s+/g, ' ') + .trim(); } _parseExercisePayload(value) { diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index d94c24a..af31fa6 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -2705,7 +2705,8 @@ export default { .trim() .toLowerCase() .replace(/[\p{P}]+/gu, ' ') - .replace(/\s+/g, ' '); + .replace(/\s+/g, ' ') + .trim(); }, normalizeVocab(s) { return this.normalizeComparableText(s);