mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +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,
|
page,
|
||||||
100,
|
100,
|
||||||
);
|
);
|
||||||
let udocs = [];
|
const udict = await user.getList(domainId, dudocs.map((dudoc) => dudoc.uid));
|
||||||
for (const dudoc of dudocs) {
|
const udocs = Object.values(udict);
|
||||||
udocs.push(user.getById(domainId, dudoc.uid));
|
|
||||||
}
|
|
||||||
udocs = await Promise.all(udocs);
|
|
||||||
this.response.template = 'ranking.html';
|
this.response.template = 'ranking.html';
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
udocs, upcount, ucount, page,
|
udocs, upcount, ucount, page,
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export class HomeHandler extends Handler {
|
|||||||
|
|
||||||
async getRanking(domainId: string, limit = 50) {
|
async getRanking(domainId: string, limit = 50) {
|
||||||
if (!this.user.hasPerm(PERM.PERM_VIEW_RANKING)) return [];
|
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();
|
.sort({ rp: -1 }).project({ uid: 1 }).limit(limit).toArray();
|
||||||
const uids = dudocs.map((dudoc) => dudoc.uid);
|
const uids = dudocs.map((dudoc) => dudoc.uid);
|
||||||
this.collectUser(uids);
|
this.collectUser(uids);
|
||||||
|
|||||||
Reference in new issue
Block a user