From ecbe9e446b214a3b9c0373dff7083aca09ffca49 Mon Sep 17 00:00:00 2001 From: ishiko Date: Tue, 17 Dec 2024 19:33:57 +0800 Subject: [PATCH] pref code --- src/fsrs/impl/basic_scheduler.ts | 14 ++++++++------ src/fsrs/impl/long_term_scheduler.ts | 12 +++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/fsrs/impl/basic_scheduler.ts b/src/fsrs/impl/basic_scheduler.ts index 7be9bf5..b0574c0 100644 --- a/src/fsrs/impl/basic_scheduler.ts +++ b/src/fsrs/impl/basic_scheduler.ts @@ -186,17 +186,19 @@ export default class BasicScheduler extends AbstractScheduler { difficulty, Rating.Again ) - next_again.stability = this.algorithm.next_forget_stability( - difficulty, - stability, - retrievability - ) const nextSMin = stability / Math.exp( this.algorithm.parameters.w[17] * this.algorithm.parameters.w[18] ) - next_again.stability = Math.min(nextSMin, next_again.stability) + next_again.stability = Math.min( + +nextSMin.toFixed(8), + this.algorithm.next_forget_stability( + difficulty, + stability, + retrievability + ) + ) next_hard.difficulty = this.algorithm.next_difficulty( difficulty, diff --git a/src/fsrs/impl/long_term_scheduler.ts b/src/fsrs/impl/long_term_scheduler.ts index 8a30bfd..5616a9a 100644 --- a/src/fsrs/impl/long_term_scheduler.ts +++ b/src/fsrs/impl/long_term_scheduler.ts @@ -112,13 +112,15 @@ export default class LongTermScheduler extends AbstractScheduler { difficulty, Rating.Again ) - next_again.stability = this.algorithm.next_forget_stability( - difficulty, + next_again.stability = Math.min( stability, - retrievability + this.algorithm.next_forget_stability( + difficulty, + stability, + retrievability + ) ) - next_again.stability = Math.min(stability, next_again.stability) - + next_hard.difficulty = this.algorithm.next_difficulty( difficulty, Rating.Hard