feat: füge sicheres Backup des alten Frontends hinzu und verbessere Fehlerbehandlung in normalizePool
All checks were successful
Deploy to production / deploy (push) Successful in 1m59s

This commit is contained in:
Torsten Schulz (local)
2026-06-04 18:20:07 +02:00
parent 4754ae37da
commit 3176a8b07f
2 changed files with 35 additions and 21 deletions

View File

@@ -57,9 +57,12 @@ echo "✅ Build erfolgreich!"
echo "Erstelle Zielverzeichnis..." echo "Erstelle Zielverzeichnis..."
sudo mkdir -p /opt/yourpart/frontend/dist sudo mkdir -p /opt/yourpart/frontend/dist
# 7. Altes Frontend löschen # 7. Sicheres Backup des alten Frontends (timestamped). Vermeidet Datenverlust bei Fehlern.
echo "Lösche altes Frontend..." if [ -d "/opt/yourpart/frontend/dist" ]; then
sudo rm -rf /opt/yourpart/frontend/dist TIMESTAMP=$(date +%Y%m%d-%H%M%S)
echo "Erstelle Backup von altem Frontend nach /opt/yourpart/frontend/dist.backup.$TIMESTAMP"
sudo mv /opt/yourpart/frontend/dist /opt/yourpart/frontend/dist.backup.$TIMESTAMP || true
fi
# 8. Zielverzeichnis neu erstellen # 8. Zielverzeichnis neu erstellen
echo "Erstelle Zielverzeichnis neu..." echo "Erstelle Zielverzeichnis neu..."

View File

@@ -697,9 +697,13 @@ export default {
return [{ ...item, learning, reference }]; return [{ ...item, learning, reference }];
}, },
normalizePool(items = []) { normalizePool(items = []) {
try {
const inputLen = Array.isArray(items) ? items.length : 0;
const seen = new Set(); const seen = new Set();
return (Array.isArray(items) ? items : []) const expanded = (Array.isArray(items) ? items : [])
.flatMap((item, index) => this.expandPoolItemAlternatives(item).map((candidate, altIndex) => ({ candidate, index, altIndex }))) .flatMap((item, index) => this.expandPoolItemAlternatives(item).map((candidate, altIndex) => ({ candidate, index, altIndex })));
const mapped = expanded
.map(({ candidate, index, altIndex }) => { .map(({ candidate, index, altIndex }) => {
const learning = String(candidate?.learning || '').trim(); const learning = String(candidate?.learning || '').trim();
const reference = String(candidate?.reference || '').trim(); const reference = String(candidate?.reference || '').trim();
@@ -713,8 +717,15 @@ export default {
learning, learning,
reference reference
}; };
}) });
.filter(Boolean);
const result = mapped.filter(Boolean);
try { console.debug('[VocabPracticeDialog] normalizePool', { inputLen, outLen: result.length, sample: result.slice(0,5) }); } catch (_) {}
return result;
} catch (e) {
console.warn('[VocabPracticeDialog] normalizePool failed', e);
return [];
}
}, },
resetQuestion() { resetQuestion() {
this.current = null; this.current = null;