Skip to content

Commit

Permalink
change lease ordering fields
Browse files Browse the repository at this point in the history
change is matching change in API
  • Loading branch information
henrinie-nc committed Jun 6, 2024
1 parent ce9536b commit 6bbd6c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/leases/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2783,13 +2783,13 @@ export const mapLeaseSearchFilters = (query: Record<string, any>): Record<string

if (searchQuery.sort_key) {
if (searchQuery.sort_key === 'identifier') {
searchQuery.ordering = ['identifier__type__identifier', 'identifier__municipality__identifier', 'identifier__district__identifier', 'identifier__sequence'];
searchQuery.ordering = ['type__identifier', 'municipality__identifier', 'district__identifier', 'identifier__sequence'];
} else {
searchQuery.ordering = [searchQuery.sort_key];
}

if (searchQuery.sort_order === TableSortOrder.DESCENDING) {
searchQuery.ordering = searchQuery.ordering.map(key => `-${key}`);
searchQuery.ordering = searchQuery.ordering.map((key: string) => `-${key}`);
}

delete searchQuery.sort_key;
Expand Down

0 comments on commit 6bbd6c7

Please sign in to comment.