nsarrazin HF Staff commited on
Commit
5f03c37
·
1 Parent(s): 1a1cada

fix(assistants): sort before skipping

Browse files
src/routes/assistants/+page.server.ts CHANGED
@@ -55,12 +55,12 @@ export const load = async ({ url, locals }) => {
55
  const assistants = await Database.getInstance()
56
  .getCollections()
57
  .assistants.find(filter)
58
- .skip(NUM_PER_PAGE * pageIndex)
59
  .sort({
60
  ...(sort === SortKey.TRENDING && { last24HoursUseCount: -1 }),
61
  useCount: -1,
62
  _id: 1,
63
  })
 
64
  .limit(NUM_PER_PAGE)
65
  .toArray();
66
 
 
55
  const assistants = await Database.getInstance()
56
  .getCollections()
57
  .assistants.find(filter)
 
58
  .sort({
59
  ...(sort === SortKey.TRENDING && { last24HoursUseCount: -1 }),
60
  useCount: -1,
61
  _id: 1,
62
  })
63
+ .skip(NUM_PER_PAGE * pageIndex)
64
  .limit(NUM_PER_PAGE)
65
  .toArray();
66