feat: verbessere initialTotalDue und begrenze tägliche Übungsanzahl auf MAX_DAILY_DUE
All checks were successful
Deploy to production / deploy (push) Successful in 1m59s
All checks were successful
Deploy to production / deploy (push) Successful in 1m59s
This commit is contained in:
@@ -193,14 +193,16 @@ export default class VocabService {
|
||||
}
|
||||
|
||||
// Determine safe default nextDueAt for newly created items:
|
||||
// - default: next calendar day at 08:00
|
||||
// - ensure at least 24 hours after creation
|
||||
// - prefer a calendar time (08:00) at least one day after creation
|
||||
// - ensure at least 48 hours after creation so freshly practiced items
|
||||
// don't immediately appear as due the next day
|
||||
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;
|
||||
// consider the day after tomorrow as earliest calendar slot
|
||||
nextCalendar08.setDate(nextCalendar08.getDate() + 2);
|
||||
const min48h = new Date(createdAt.getTime() + 48 * 60 * 60 * 1000);
|
||||
const safeNextDue = nextCalendar08.getTime() < min48h.getTime() ? min48h : nextCalendar08;
|
||||
|
||||
const created = await VocabSrsItem.create({
|
||||
userId,
|
||||
|
||||
Reference in New Issue
Block a user