core: ranking: ignore rp=0

This commit is contained in:
undefined committed 2024-01-04 17:59:48 +08:00
1 parent 3ede50a237
commit 96934ce984
2 files changed
+3 -6

No files matched your search

+2 -5
View File
@@ -63,11 +63,8 @@ class DomainRankHandler extends Handler {
page,
100,
);
let udocs = [];
for (const dudoc of dudocs) {
udocs.push(user.getById(domainId, dudoc.uid));
}
udocs = await Promise.all(udocs);
const udict = await user.getList(domainId, dudocs.map((dudoc) => dudoc.uid));
const udocs = Object.values(udict);
this.response.template = 'ranking.html';
this.response.body = {
udocs, upcount, ucount, page,
+1 -1
View File
@@ -110,7 +110,7 @@ export class HomeHandler extends Handler {
async getRanking(domainId: string, limit = 50) {
if (!this.user.hasPerm(PERM.PERM_VIEW_RANKING)) return [];
const dudocs = await domain.getMultiUserInDomain(domainId, { uid: { $gt: 1 } })
const dudocs = await domain.getMultiUserInDomain(domainId, { uid: { $gt: 1 }, rp: { $gt: 0 } })
.sort({ rp: -1 }).project({ uid: 1 }).limit(limit).toArray();
const uids = dudocs.map((dudoc) => dudoc.uid);
this.collectUser(uids);