From 6db71888a6a5a2b5bdf12a51e6aa74f764a4ab92 Mon Sep 17 00:00:00 2001 From: ishiko Date: Sun, 19 Nov 2023 13:22:30 +0800 Subject: [PATCH] Fix/forget (#50) * Fix/wrong scheduled_days in forget * 3.1.0-beta8 --- package.json | 2 +- src/fsrs/default.ts | 2 +- src/fsrs/fsrs.ts | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1146822..aba9dcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-fsrs", - "version": "3.1.0-beta7", + "version": "3.1.0-beta8", "description": "ts-fsrs is a TypeScript package used to implement the Free Spaced Repetition Scheduler (FSRS) algorithm. It helps developers apply FSRS to their flashcard applications, thereby improving the user learning experience.", "main": "dist/ts-fsrs.js", "module": "dist/ts-fsrs.mjs", diff --git a/src/fsrs/default.ts b/src/fsrs/default.ts index d6ced4d..e8a9fa8 100644 --- a/src/fsrs/default.ts +++ b/src/fsrs/default.ts @@ -9,7 +9,7 @@ export const default_w = [ ]; export const default_enable_fuzz = false; -export const FSRSVersion: string = "3.1.0-beta7"; +export const FSRSVersion: string = "3.1.0-beta8"; export const generatorParameters = ( props?: Partial, diff --git a/src/fsrs/fsrs.ts b/src/fsrs/fsrs.ts index ddd4c7b..6b39d68 100644 --- a/src/fsrs/fsrs.ts +++ b/src/fsrs/fsrs.ts @@ -146,6 +146,8 @@ export class FSRS extends FSRSAlgorithm { ): RecordLogItem => { card = this.preProcessCard(card); now = this.preProcessDate(now); + const scheduled_days = + card.state === State.New ? 0 : now.diff(card.last_review as Date, "days"); const forget_log: ReviewLog = { rating: Rating.Manual, state: card.state, @@ -154,7 +156,7 @@ export class FSRS extends FSRSAlgorithm { difficulty: card.difficulty, elapsed_days: 0, last_elapsed_days: card.elapsed_days, - scheduled_days: card.scheduled_days, + scheduled_days: scheduled_days, review: now, }; const forget_card: Card = {