diff --git a/apiserver/plane/utils/order_queryset.py b/apiserver/plane/utils/order_queryset.py index aafa954dc..920e5b1e0 100644 --- a/apiserver/plane/utils/order_queryset.py +++ b/apiserver/plane/utils/order_queryset.py @@ -30,9 +30,9 @@ def order_issue_queryset(issue_queryset, order_by_param="-created_at"): ) ).order_by("priority_order") order_by_param = ( - "-priority_order" + "priority_order" if order_by_param.startswith("-") - else "priority_order" + else "-priority_order" ) # State Ordering elif order_by_param in [ diff --git a/web/core/constants/issue.ts b/web/core/constants/issue.ts index f9a82056a..3d00e34eb 100644 --- a/web/core/constants/issue.ts +++ b/web/core/constants/issue.ts @@ -95,7 +95,7 @@ export const ISSUE_ORDER_BY_OPTIONS: { { key: "-updated_at", title: "Last Updated" }, { key: "start_date", title: "Start Date" }, { key: "target_date", title: "Due Date" }, - { key: "priority", title: "Priority" }, + { key: "-priority", title: "Priority" }, ]; export const ISSUE_FILTER_OPTIONS: { @@ -208,7 +208,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS, display_filters: { group_by: ["state_detail.group", "priority", "project", "labels", null], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -221,7 +221,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS, display_filters: { group_by: ["state_detail.group", "priority", "project", "labels"], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -257,7 +257,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { "created_by", null, ], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -272,7 +272,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS, display_filters: { group_by: ["state_detail.group", "cycle", "module", "priority", "project", "labels", null], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -285,7 +285,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS, display_filters: { group_by: ["state_detail.group", "cycle", "module", "priority", "project", "labels"], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -357,7 +357,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS, display_filters: { group_by: ["state", "priority", "cycle", "module", "labels", "assignees", "created_by", null], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -383,7 +383,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { display_filters: { group_by: ["state", "priority", "cycle", "module", "labels", "assignees", "created_by"], sub_group_by: ["state", "priority", "cycle", "module", "labels", "assignees", "created_by", null], - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority", "target_date"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority", "target_date"], type: [null, "active", "backlog"], }, extra_options: { @@ -429,7 +429,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { ], display_properties: ISSUE_DISPLAY_PROPERTIES_KEYS, display_filters: { - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { @@ -453,7 +453,7 @@ export const ISSUE_DISPLAY_FILTERS_BY_LAYOUT: { ], display_properties: ["key", "issue_type"], display_filters: { - order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "priority"], + order_by: ["sort_order", "-created_at", "-updated_at", "start_date", "-priority"], type: [null, "active", "backlog"], }, extra_options: { diff --git a/web/core/constants/spreadsheet.ts b/web/core/constants/spreadsheet.ts index 9ba69cbf2..e4e8d8ee5 100644 --- a/web/core/constants/spreadsheet.ts +++ b/web/core/constants/spreadsheet.ts @@ -115,9 +115,9 @@ export const SPREADSHEET_PROPERTY_DETAILS: { }, priority: { title: "Priority", - ascendingOrderKey: "-priority", + ascendingOrderKey: "priority", ascendingOrderTitle: "None", - descendingOrderKey: "priority", + descendingOrderKey: "-priority", descendingOrderTitle: "Urgent", icon: Signal, Column: SpreadsheetPriorityColumn, diff --git a/web/core/store/issue/helpers/base-issues.store.ts b/web/core/store/issue/helpers/base-issues.store.ts index 87176d87c..fa5cd9ff0 100644 --- a/web/core/store/issue/helpers/base-issues.store.ts +++ b/web/core/store/issue/helpers/base-issues.store.ts @@ -1744,11 +1744,11 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore { ); // custom - case "priority": { + case "-priority": { const sortArray = ISSUE_PRIORITIES.map((i) => i.key); return getIssueIds(orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue?.priority))); } - case "-priority": { + case "priority": { const sortArray = ISSUE_PRIORITIES.map((i) => i.key); return getIssueIds( orderBy(array, (currentIssue: TIssue) => indexOf(sortArray, currentIssue?.priority), ["desc"])