feat(review): combine due notes and today-only notes in default view

This commit is contained in:
dralkh 2025-09-24 16:28:21 +03:00
parent aa060b7ee6
commit 52efa857af
3 changed files with 38 additions and 13 deletions

View file

@ -138,7 +138,27 @@ export class ReviewControllerCore implements IReviewController {
// If currentReviewDateOverride is set, we are viewing a specific date from the calendar, so match exactly.
// Otherwise (override is null), we are in the default "today" view, so get all notes due up to today.
const matchExactDate = this.currentReviewDateOverride !== null;
const newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, matchExactDate);
let newDueNotes: ReviewSchedule[];
if (matchExactDate) {
// Calendar view: Get notes for the specific date
newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
} else {
// Default view: Get notes due up to today AND notes for today's date
const dueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, false);
const todayOnlyNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
const combinedNotes = [...dueNotes, ...todayOnlyNotes];
const uniqueNotes = new Map<string, ReviewSchedule>();
for (const note of combinedNotes) {
if (!uniqueNotes.has(note.path)) {
uniqueNotes.set(note.path, note);
}
}
newDueNotes = Array.from(uniqueNotes.values());
}
this.todayNotes = newDueNotes;
// The traversal order should directly reflect the order of todayNotes,

22
main.js
View file

@ -1342,7 +1342,21 @@ var ReviewControllerCore = class {
const originalPositions = new Map(this.traversalPositions);
const effectiveDate = this.getEffectiveReviewDate();
const matchExactDate = this.currentReviewDateOverride !== null;
const newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, matchExactDate);
let newDueNotes;
if (matchExactDate) {
newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
} else {
const dueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, false);
const todayOnlyNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
const combinedNotes = [...dueNotes, ...todayOnlyNotes];
const uniqueNotes = /* @__PURE__ */ new Map();
for (const note of combinedNotes) {
if (!uniqueNotes.has(note.path)) {
uniqueNotes.set(note.path, note);
}
}
newDueNotes = Array.from(uniqueNotes.values());
}
this.todayNotes = newDueNotes;
this.traversalOrder = this.todayNotes.map((note) => note.path);
this.traversalPositions = /* @__PURE__ */ new Map();
@ -5942,11 +5956,7 @@ var CalendarView = class {
const today = /* @__PURE__ */ new Date();
const isClickedDateToday = DateUtils.isSameDay(currentDateObj, today);
this.plugin.settings.sidebarViewType = "list";
if (isClickedDateToday) {
this.plugin.clickedDateFromCalendar = null;
} else {
this.plugin.clickedDateFromCalendar = currentDateObj;
}
this.plugin.clickedDateFromCalendar = currentDateObj;
await this.plugin.savePluginData();
const sidebarView = this.plugin.getSidebarView();
if (sidebarView && typeof sidebarView.refresh === "function") {

View file

@ -221,12 +221,7 @@ export class CalendarView {
const isClickedDateToday = DateUtils.isSameDay(currentDateObj, today);
this.plugin.settings.sidebarViewType = 'list';
if (isClickedDateToday) {
this.plugin.clickedDateFromCalendar = null;
} else {
this.plugin.clickedDateFromCalendar = currentDateObj;
}
this.plugin.clickedDateFromCalendar = currentDateObj;
await this.plugin.savePluginData();
const sidebarView = this.plugin.getSidebarView();