Compare commits
1 Commits
4e3823473f
...
b8109d0bc4
Author | SHA1 | Date | |
---|---|---|---|
b8109d0bc4 |
@ -40,18 +40,20 @@ export const getLeaderboard = async (
|
||||
return [];
|
||||
}
|
||||
const beforeDocs = await Leaderboard.find({
|
||||
leaderboard,
|
||||
score: { $gt: pivotDoc.score }
|
||||
})
|
||||
.sort({ score: 1 })
|
||||
.limit(before);
|
||||
const afterDocs = await Leaderboard.find({
|
||||
leaderboard,
|
||||
score: { $lt: pivotDoc.score }
|
||||
})
|
||||
.sort({ score: -1 })
|
||||
.limit(after);
|
||||
entries = [...beforeDocs.reverse(), pivotDoc, ...afterDocs];
|
||||
r = await Leaderboard.countDocuments({
|
||||
leaderboard: leaderboard,
|
||||
leaderboard,
|
||||
score: { $gt: pivotDoc.score }
|
||||
});
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user