From 22bef8f671ba442a719a62b7e741549e73c6c81b Mon Sep 17 00:00:00 2001 From: ldeluigi <44567586+ldeluigi@users.noreply.github.com> Date: Wed, 29 May 2024 21:57:54 +0200 Subject: [PATCH] feat: sort combo result by identity and cards before inverse created date --- src/pages/featured.tsx | 2 +- src/pages/search.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/featured.tsx b/src/pages/featured.tsx index 063f257591..7df5e41b1a 100644 --- a/src/pages/featured.tsx +++ b/src/pages/featured.tsx @@ -42,7 +42,7 @@ const Featured = ({ combos }: Props) => { export const getServerSideProps: GetServerSideProps = async (context) => { const requestService = new RequestService(context) - const results = await requestService.get>(`${process.env.NEXT_PUBLIC_EDITOR_BACKEND_URL}/variants/?q=is:featured legal:commander&ordering=-created`) + const results = await requestService.get>(`${process.env.NEXT_PUBLIC_EDITOR_BACKEND_URL}/variants/?q=is:featured legal:commander&ordering=identity_count,cards_count,-created`) const backendCombos = results ? results.results : [] return { props: { diff --git a/src/pages/search.tsx b/src/pages/search.tsx index a3180655c2..61f29ae9ae 100644 --- a/src/pages/search.tsx +++ b/src/pages/search.tsx @@ -186,7 +186,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { const requestService = new RequestService(context) const order = context.query.order || DEFAULT_ORDER const sort = context.query.sort || DEFAULT_SORT - const ordering = order === 'auto' ? `${AUTO_SORT_MAP[sort as string] || ''}${sort}` : `${order === 'asc' ? '' : '-'}${sort}` + const ordering = (order === 'auto' ? `${AUTO_SORT_MAP[sort as string] || ''}${sort}` : `${order === 'asc' ? '' : '-'}${sort}`) + ',identity_count,cards_count,-created' const url = `${process.env.NEXT_PUBLIC_EDITOR_BACKEND_URL}/variants/?q=${query}&limit=${PAGE_SIZE}&offset=${((Number(context.query.page) || 1) - 1) * PAGE_SIZE}&ordering=${ordering}` const results = await requestService.get>(url);