Skip to content

Commit e92eabc

Browse files
fix: Review only due notes (#1088)
This patch fixes the behaviour of determining the next note to only consider notes that are due. If a note is scheduled in the future, it won't be picked up for review until it's due. This is the same patch as #947. Fixes #328.
1 parent 12b3651 commit e92eabc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/note-review-deck.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { t } from "src/lang/helpers";
22
import { ISRFile } from "src/sr-file";
3+
import { globalDateProvider } from "src/utils/dates";
34
import { globalRandomNumberProvider } from "src/utils/numbers";
45

56
export class SchedNote {
@@ -81,10 +82,12 @@ export class NoteReviewDeck {
8182
determineNextNote(openRandomNote: boolean): ISRFile {
8283
// Review due notes before new ones
8384
if (this.dueNotesCount > 0) {
85+
const todayUnix: number = globalDateProvider.today.valueOf();
86+
const dueNotes = this.scheduledNotes.filter((note) => note.isDue(todayUnix));
8487
const index = openRandomNote
85-
? globalRandomNumberProvider.getInteger(0, this.dueNotesCount - 1)
88+
? globalRandomNumberProvider.getInteger(0, dueNotes.length - 1)
8689
: 0;
87-
return this.scheduledNotes[index].note;
90+
return dueNotes[index].note;
8891
}
8992

9093
if (this.newNotes.length > 0) {

0 commit comments

Comments
 (0)