fix orderby priority for spreadsheet

This commit is contained in:
rahulramesha 2024-03-26 12:27:43 +05:30
parent 6cdc670bc3
commit a9ffd18a2f
2 changed files with 7 additions and 7 deletions

View File

@ -101,9 +101,9 @@ export const SPREADSHEET_PROPERTY_DETAILS: {
}, },
priority: { priority: {
title: "Priority", title: "Priority",
ascendingOrderKey: "priority", ascendingOrderKey: "-priority",
ascendingOrderTitle: "None", ascendingOrderTitle: "None",
descendingOrderKey: "-priority", descendingOrderKey: "priority",
descendingOrderTitle: "Urgent", descendingOrderTitle: "Urgent",
icon: Signal, icon: Signal,
Column: SpreadsheetPriorityColumn, Column: SpreadsheetPriorityColumn,

View File

@ -783,7 +783,7 @@ export class BaseIssuesStore implements IBaseIssuesStore {
issuesSortWithOrderBy = (issueIds: string[], key: TIssueOrderByOptions | undefined): string[] => { issuesSortWithOrderBy = (issueIds: string[], key: TIssueOrderByOptions | undefined): string[] => {
const issues = this.rootIssueStore.issues.getIssuesByIds(issueIds, this.isArchived ? "archived" : "un-archived"); const issues = this.rootIssueStore.issues.getIssuesByIds(issueIds, this.isArchived ? "archived" : "un-archived");
const array = orderBy(issues, "created_at", ["asc"]); const array = orderBy(issues, "created_at", ["desc"]);
switch (key) { switch (key) {
case "sort_order": case "sort_order":
@ -834,13 +834,13 @@ export class BaseIssuesStore implements IBaseIssuesStore {
// custom // custom
case "priority": { case "priority": {
const sortArray = ISSUE_PRIORITIES.map((i) => i.key); const sortArray = ISSUE_PRIORITIES.map((i) => i.key);
return this.getIssueIds( return this.getIssueIds(orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority)));
orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority), ["desc"])
);
} }
case "-priority": { case "-priority": {
const sortArray = ISSUE_PRIORITIES.map((i) => i.key); const sortArray = ISSUE_PRIORITIES.map((i) => i.key);
return this.getIssueIds(orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority))); return this.getIssueIds(
orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue.priority), ["desc"])
);
} }
// number // number