feat: verbessere SRS-Logik zur Bestimmung des nächsten Fälligkeitsdatums für neu erstellte Elemente und erweitere die API-Anfragen für kursweite fällige Items
All checks were successful
Deploy to production / deploy (push) Successful in 2m6s
All checks were successful
Deploy to production / deploy (push) Successful in 2m6s
This commit is contained in:
@@ -191,6 +191,17 @@ export default class VocabService {
|
||||
if (existingByKey.has(entry.itemKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine safe default nextDueAt for newly created items:
|
||||
// - default: next calendar day at 08:00
|
||||
// - ensure at least 24 hours after creation
|
||||
const createdAt = new Date(now);
|
||||
const nextCalendar08 = new Date(createdAt);
|
||||
nextCalendar08.setHours(8, 0, 0, 0);
|
||||
nextCalendar08.setDate(nextCalendar08.getDate() + 1);
|
||||
const min24h = new Date(createdAt.getTime() + 24 * 60 * 60 * 1000);
|
||||
const safeNextDue = nextCalendar08.getTime() < min24h.getTime() ? min24h : nextCalendar08;
|
||||
|
||||
const created = await VocabSrsItem.create({
|
||||
userId,
|
||||
courseId: Number(courseId),
|
||||
@@ -199,7 +210,7 @@ export default class VocabService {
|
||||
learning: entry.learning,
|
||||
reference: entry.reference,
|
||||
direction: entry.direction,
|
||||
nextDueAt: now
|
||||
nextDueAt: safeNextDue
|
||||
});
|
||||
createdItems.push(created);
|
||||
existingByKey.set(entry.itemKey, created);
|
||||
|
||||
Reference in New Issue
Block a user