Skip to content

Commit

Permalink
pref/remove calculation of last_elapsed_days by rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiko732 committed Nov 11, 2023
1 parent c9d994d commit 410b469
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/fsrs/fsrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ export class FSRS extends FSRSAlgorithm {
if (log.rating === Rating.Manual) {
throw new Error("Cannot rollback a manual rating");
}
let last_due, last_review, last_lapses, last_elapsed_days;
let last_due, last_review, last_lapses;
switch (log.state) {
case State.New:
last_due = log.due;
last_review = undefined;
last_lapses = 0;
last_elapsed_days = 0;
break;
case State.Learning:
case State.Relearning:
Expand All @@ -123,10 +122,6 @@ export class FSRS extends FSRSAlgorithm {
last_lapses =
card.lapses -
(log.rating === Rating.Again && log.state === State.Review ? 1 : 0);
last_elapsed_days =
log.elapsed_days == 0
? 0
: card.scheduled_days;
break;
}

Expand Down

0 comments on commit 410b469

Please sign in to comment.