Skip to content

Commit

Permalink
fix: recent notes are sorted ascending (#1252)
Browse files Browse the repository at this point in the history
fixes: #1241
  • Loading branch information
TheSlimvReal authored May 5, 2022
1 parent fa190d2 commit f9b2406
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ export class NotesDashboardComponent
) {
const queryRange = Math.round((dayRangeBoundary * 3) / 10) * 10; // query longer range to be able to display exact date of last note for recent

// recent notes are sorted ascending, without recent notes descending
const order = this.mode === "with-recent-notes" ? -1 : 1;
const promise = this.childrenService
.getDaysSinceLastNoteOfEachChild(queryRange)
.then((children) => {
return Array.from(children)
.filter(filter)
.map((stat) => statsToChildWithRecentNoteInfo(stat, queryRange))
.sort((a, b) => b.daysSinceLastNote - a.daysSinceLastNote);
.sort((a, b) => order * (b.daysSinceLastNote - a.daysSinceLastNote));
});
promise.then((children) => {
this.concernedChildren = children;
Expand Down

0 comments on commit f9b2406

Please sign in to comment.