core: 修正比赛中的提交被标记为hidden的问题

This commit is contained in:
undefined committed 2020-11-08 13:01:04 +08:00
1 parent 58807c4148
commit 1afb022c32
3 files changed
+17 -9

No files matched your search

+14 -7
View File
@@ -1,4 +1,4 @@
import { ObjectID } from 'mongodb';
import { FilterQuery, ObjectID } from 'mongodb';
import { PermissionError, RecordNotFoundError } from '../error';
import { PERM, CONSTANT, STATUS } from '../model/builtin';
import * as problem from '../model/problem';
@@ -23,14 +23,21 @@ class RecordListHandler extends RecordHandler {
@param('uidOrName', Types.String, true)
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string) {
this.response.template = 'record_main.html';
const q: any = { tid, hidden: false };
const q: FilterQuery<Rdoc> = { 'contest.tid': tid, hidden: false };
if (uidOrName) {
q.$or = [
{ unameLower: uidOrName.toLowerCase() },
{ _id: parseInt(uidOrName, 10) },
];
let udoc = await user.getById(domainId, +uidOrName);
if (udoc) q.uid = udoc._id;
else {
udoc = await user.getByUname(domainId, uidOrName);
if (udoc) q.uid = udoc._id;
else q.uid = null;
}
}
if (pid) {
const pdoc = await problem.get(domainId, pid);
if (pdoc) q.pid = pdoc.docId;
else q.pid = null;
}
if (pid) q.pid = pid;
const [rdocs] = await paginate(
record.getMulti(domainId, q).sort('_id', -1),
page,