Skip to content

Commit

Permalink
feat: sort combo result by identity and cards before inverse created …
Browse files Browse the repository at this point in the history
…date
  • Loading branch information
ldeluigi committed May 29, 2024
1 parent 2cf1d57 commit 22bef8f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/featured.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Featured = ({ combos }: Props) => {

export const getServerSideProps: GetServerSideProps = async (context) => {
const requestService = new RequestService(context)
const results = await requestService.get<PaginatedResponse<Variant>>(`${process.env.NEXT_PUBLIC_EDITOR_BACKEND_URL}/variants/?q=is:featured legal:commander&ordering=-created`)
const results = await requestService.get<PaginatedResponse<Variant>>(`${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: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<PaginatedResponse<Variant>>(url);

Expand Down

0 comments on commit 22bef8f

Please sign in to comment.