Adds a full flashcards system: FSRS-based scheduling, cloze/basic card types, CSV import/export, media storage, and study UI, wired into navigation and the dashboard alongside existing question flows.
15 lines
798 B
C#
15 lines
798 B
C#
namespace QuestionsApi.Services.Flashcards;
|
|
|
|
// Small pure helpers pulled out of FlashcardStudyService/FlashcardScheduleStore so the
|
|
// daily-limit and sibling-bury rules can be unit tested without a live Mongo instance.
|
|
public static class FlashcardScheduling
|
|
{
|
|
// A card reviewed on a given local study day buries its siblings until the next local day.
|
|
public static DateTime NextStudyDayStart(DateTime studyDayStartUtc) => studyDayStartUtc.Date.AddDays(1);
|
|
|
|
// Effective per-day budget: deck override wins over the global default, minus what's
|
|
// already been consumed on the client's current local study day.
|
|
public static int ResolveDailyBudget(int globalLimit, int? deckOverride, int consumedToday) =>
|
|
Math.Max(0, (deckOverride ?? globalLimit) - consumedToday);
|
|
}
|