mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: homework: 修正导出逻辑 & record: 添加统计信息
This commit is contained in:
1 parent
f0c1b49ac1
commit
df0982c690
4 files changed
+20
-9
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { FilterQuery, ObjectID } from 'mongodb';
|
||||
import { PermissionError, RecordNotFoundError } from '../error';
|
||||
import { PERM, CONSTANT, STATUS } from '../model/builtin';
|
||||
import {
|
||||
PERM, CONSTANT, STATUS, PRIV,
|
||||
} from '../model/builtin';
|
||||
import * as problem from '../model/problem';
|
||||
import * as record from '../model/record';
|
||||
import * as contest from '../model/contest';
|
||||
@@ -19,7 +21,8 @@ class RecordListHandler extends RecordHandler {
|
||||
@param('pid', Types.String, true)
|
||||
@param('tid', Types.ObjectID, true)
|
||||
@param('uidOrName', Types.String, true)
|
||||
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string) {
|
||||
@param('allDomain', Types.Boolean, true)
|
||||
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string, all = false) {
|
||||
this.response.template = 'record_main.html';
|
||||
const q: FilterQuery<Rdoc> = { 'contest.tid': tid, hidden: false };
|
||||
if (uidOrName) {
|
||||
@@ -63,6 +66,9 @@ class RecordListHandler extends RecordHandler {
|
||||
filterTid: tid,
|
||||
filterUidOrName: uidOrName,
|
||||
};
|
||||
if (this.user.hasPriv(PRIV.PRIV_VIEW_JUDGE_STATISTICS)) {
|
||||
this.response.body.statistics = await record.stat(all ? undefined : domainId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user