mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: ranking: ignore rp=0
This commit is contained in:
2 files changed
+3
-6
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user