feat: implement neue SRS-Logik zur Berechnung von Intervallen und füge Diagnoseskript für fällige Items hinzu
All checks were successful
Deploy to production / deploy (push) Successful in 2m10s
All checks were successful
Deploy to production / deploy (push) Successful in 2m10s
This commit is contained in:
@@ -127,7 +127,6 @@ export default class VocabService {
|
||||
const previousInterval = Math.max(0, Number(item?.intervalDays) || 0);
|
||||
const normalizedRating = String(rating || '').toLowerCase();
|
||||
const isCorrect = Boolean(correct) && normalizedRating !== 'again';
|
||||
|
||||
if (!isCorrect) {
|
||||
return {
|
||||
stage: Math.max(0, previousStage - 1),
|
||||
@@ -137,25 +136,35 @@ export default class VocabService {
|
||||
};
|
||||
}
|
||||
|
||||
const intervals = [0, 1, 3, 7, 14, 30, 60, 120, 240];
|
||||
let nextStage = Math.min(intervals.length - 1, previousStage + 1);
|
||||
|
||||
if (normalizedRating === 'hard') {
|
||||
nextStage = Math.max(1, previousStage);
|
||||
}
|
||||
// Neue einfache Policy:
|
||||
// - 'easy' -> 7 Tage
|
||||
// - 'good'/'normal' -> 4 Tage
|
||||
// - 'hard' -> 1 Tag
|
||||
// Außerdem: nextDueAt darf nicht mehr am gleichen Kalendertag liegen.
|
||||
let intervalDays;
|
||||
if (normalizedRating === 'easy') {
|
||||
nextStage = Math.min(intervals.length - 1, previousStage + 2);
|
||||
intervalDays = 7;
|
||||
} else if (normalizedRating === 'hard') {
|
||||
intervalDays = 1;
|
||||
} else {
|
||||
// default / 'good' / unspecified
|
||||
intervalDays = 4;
|
||||
}
|
||||
|
||||
let intervalDays = intervals[nextStage] ?? Math.max(1, previousInterval * 2);
|
||||
if (normalizedRating === 'hard') {
|
||||
intervalDays = Math.max(1, Math.ceil(Math.max(previousInterval, 1) * 1.2));
|
||||
}
|
||||
// Bestimme nextDueAt als Start des Tages (00:00) nach intervalDays
|
||||
const nextDueAt = new Date(now);
|
||||
// Setze auf Mitternacht heute
|
||||
nextDueAt.setHours(0, 0, 0, 0);
|
||||
// Gehe vorwärts: morgen + (intervalDays - 1)
|
||||
nextDueAt.setDate(nextDueAt.getDate() + 1 + Math.max(0, intervalDays - 1));
|
||||
|
||||
// Stage-Logik: einfache Fortschrittsstufe basierend auf intervalDays
|
||||
let nextStage = Math.min(8, Math.max(0, Math.floor(Math.log2(intervalDays + 1))));
|
||||
|
||||
return {
|
||||
stage: nextStage,
|
||||
intervalDays,
|
||||
nextDueAt: new Date(now.getTime() + intervalDays * 24 * 60 * 60 * 1000),
|
||||
nextDueAt,
|
||||
lapseDelta: 0
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user