Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
k2xl committed May 31, 2024
1 parent c0b1319 commit 4e2962d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pages/[subdomain]/collection/[username]/[slugName].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
search: search ? search.toString() : '',
statFilter: statFilter ? statFilter.toString() as StatFilter : StatFilter.All,
timeRange: TimeRange[TimeRange.All],
sortBy: 'sortField',
sortBy: 'collectionOrder',
sortDir: 'asc',
// TODO: when filtering, the original collection order is not maintained and instead we sort here
// maybe need a separate doCollectionQuery function
Expand Down
6 changes: 3 additions & 3 deletions pages/api/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ export async function doQuery(gameId: GameId, query: SearchQuery, reqUser?: User
lookupUserBeforeSort = true;
} else if (query.sortBy === 'name') {
sortObj.push(['name', sortDirection]);
} else if (query.sortBy === 'sortField') {
sortObj.push(['sortField', sortDirection]);
} else if (query.sortBy === 'collectionOrder') {
sortObj.push(['collectionOrder', sortDirection]);
} else if (query.sortBy === 'leastMoves') {
sortObj.push(['leastMoves', sortDirection]);
} else if (query.sortBy === 'ts') {
Expand Down Expand Up @@ -433,7 +433,7 @@ export async function doQuery(gameId: GameId, query: SearchQuery, reqUser?: User
{ $project: { ...projection } },
{
$addFields: {
sortField: {
collectionOrder: {
$indexOfArray: [query.includeLevelIds?.split(','), { $toString: '$_id' }],
}
}
Expand Down

0 comments on commit 4e2962d

Please sign in to comment.