Skip to content

Commit

Permalink
fix: correct priorityAscending/Descending order
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiebrynes7 committed Apr 6, 2024
1 parent a671b85 commit 269d2ed
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin/src/data/transformations/sorting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("sortTasks", () => {
makeTask("b", { priority: 1 }),
makeTask("c", { priority: 4 }),
],
sortingOpts: [SortingVariant.PriorityDescending],
sortingOpts: [SortingVariant.PriorityAscending],
expectedOutput: [
makeTask("b", { priority: 1 }),
makeTask("a", { priority: 2 }),
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/data/transformations/sorting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function compareTask<T extends Task>(self: T, other: T, sorting: SortingVariant)
case SortingVariant.Priority:
// Note that priority in the API is reversed to that of in the app.
return other.priority - self.priority;
case SortingVariant.PriorityDescending:
case SortingVariant.PriorityAscending:
return self.priority - other.priority;
case SortingVariant.Date:
return compareTaskDate(self, other);
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/query/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ function optionField<T>(

const sortingLookup: Record<string, SortingVariant> = {
priority: SortingVariant.Priority,
priorityAscending: SortingVariant.Priority,
priorityDescending: SortingVariant.PriorityDescending,
priorityAscending: SortingVariant.PriorityAscending,
priorityDescending: SortingVariant.Priority,
date: SortingVariant.Date,
dateAscending: SortingVariant.Date,
dateDescending: SortingVariant.DateDescending,
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/query/query.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export enum SortingVariant {
Priority = 0,
PriorityDescending = 1,
PriorityAscending = 1,
Date = 2,
DateDescending = 3,
Order = 4,
Expand Down

0 comments on commit 269d2ed

Please sign in to comment.