Skip to content

Commit

Permalink
feat: order datasets by release date (#1320)
Browse files Browse the repository at this point in the history
Orders datasets on the `/browse-data/datasets` page by release date as
the default sort
  • Loading branch information
codemonkey800 authored Nov 6, 2024
1 parent b137eb4 commit 788c178
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const GET_DATASETS_DATA_QUERY = gql(`
query GetDatasetsData(
$limit: Int,
$offset: Int,
$order_by_dataset: order_by,
$order_by: datasets_order_by!,
$filter: datasets_bool_exp,
) {
datasets(
limit: $limit,
offset: $offset,
order_by: { title: $order_by_dataset },
order_by: [$order_by],
where: $filter
) {
id
Expand Down Expand Up @@ -382,7 +382,13 @@ export async function getBrowseDatasets({
filter: getFilter(getFilterState(params), query),
limit: MAX_PER_PAGE,
offset: (page - 1) * MAX_PER_PAGE,
order_by_dataset: orderBy,

// Order by dataset title if orderBy is set, otherwise order by release date
order_by: orderBy
? { title: orderBy }
: {
release_date: Order_By.Desc,
},
},
})

Expand Down

0 comments on commit 788c178

Please sign in to comment.