mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: 计算ranking时忽略Hydro用户
This commit is contained in:
1 parent
382dd53c0c
commit
923d10fb84
4 files changed
+4
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.28.33",
|
||||
"version": "2.28.34",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -24,7 +24,7 @@ class DomainRankHandler extends Handler {
|
||||
@query('page', Types.PositiveInt, true)
|
||||
async get(domainId: string, page = 1) {
|
||||
const [dudocs, upcount, ucount] = await paginate(
|
||||
domain.getMultiUserInDomain(domainId).sort({ rp: -1 }),
|
||||
domain.getMultiUserInDomain(domainId, { uid: { $nin: [0, 1] } }).sort({ rp: -1 }),
|
||||
page,
|
||||
100,
|
||||
);
|
||||
|
||||
@@ -87,7 +87,7 @@ class HomeHandler extends Handler {
|
||||
|
||||
async getRanking(domainId: string, limit: number = 50) {
|
||||
if (this.user.hasPerm(PERM.PERM_VIEW_RANKING)) {
|
||||
const dudocs = await domain.getMultiUserInDomain(domainId)
|
||||
const dudocs = await domain.getMultiUserInDomain(domainId, { uid: { $nin: [0, 1] } })
|
||||
.sort({ rp: -1 }).project({ uid: 1 }).limit(limit).toArray();
|
||||
const uids = dudocs.map((dudoc) => dudoc.uid);
|
||||
this.collectUser(uids);
|
||||
|
||||
@@ -95,6 +95,7 @@ export async function calcLevel(domainId: string, report: Function) {
|
||||
let bulk = coll.initializeUnorderedBulkOp();
|
||||
while (await ducur.hasNext()) {
|
||||
const dudoc = await ducur.next();
|
||||
if ([0, 1].includes(dudoc.uid)) continue;
|
||||
count++;
|
||||
if (!dudoc.rp) dudoc.rp = null;
|
||||
if (dudoc.rp !== last.rp) rank = count;
|
||||
|
||||
Reference in new issue
Block a user