-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Doc/wrong annotations * Fix/missing 'last_review' in the data returned by the 'createEmptyCard' function * Fix/incorrect log in record_log * Feat/rollback card utilizing the current card and log * Test/rollback * Test/first repeat (#39) * 3.1.0-beta1
- Loading branch information
Showing
7 changed files
with
196 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createEmptyCard, fsrs, FSRS, Rating } from "../src/fsrs"; | ||
|
||
describe("FSRS rollback", () => { | ||
const f: FSRS = fsrs({ | ||
w: [ | ||
1.14, 1.01, 5.44, 14.67, 5.3024, 1.5662, 1.2503, 0.0028, 1.5489, 0.1763, | ||
0.9953, 2.7473, 0.0179, 0.3105, 0.3976, 0.0, 2.0902, | ||
], | ||
enable_fuzz: false, | ||
}); | ||
it("first rollback", () => { | ||
const card = createEmptyCard(); | ||
const now = new Date(2022, 11, 29, 12, 30, 0, 0); | ||
const scheduling_cards = f.repeat(card, now); | ||
const grade = [Rating.Again, Rating.Hard, Rating.Good, Rating.Easy]; | ||
for (const rating of grade) { | ||
const rollbackCard = f.rollback( | ||
scheduling_cards[rating].card, | ||
scheduling_cards[rating].log, | ||
); | ||
expect(rollbackCard).toEqual(card); | ||
} | ||
}); | ||
|
||
it("rollback 2", () => { | ||
let card = createEmptyCard(); | ||
let now = new Date(2022, 11, 29, 12, 30, 0, 0); | ||
let scheduling_cards = f.repeat(card, now); | ||
card = scheduling_cards["4"].card; | ||
now = card.due; | ||
scheduling_cards = f.repeat(card, now); | ||
const grade = [Rating.Again, Rating.Hard, Rating.Good,Rating.Easy]; | ||
for (const rating of grade) { | ||
const rollbackCard = f.rollback( | ||
scheduling_cards[rating].card, | ||
scheduling_cards[rating].log, | ||
); | ||
expect(rollbackCard).toEqual(card); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters