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

pull/21/head
undefined 4 years ago
parent 58807c4148
commit 1afb022c32

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.13.44",
"version": "2.13.45",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",

@ -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,

@ -89,7 +89,7 @@ export async function add(
score: 0,
time: 0,
memory: 0,
hidden: !!contestOrConfig,
hidden: false,
judgeTexts: [],
compilerTexts: [],
testCases: [],
@ -102,6 +102,7 @@ export async function add(
data.contest = contestOrConfig as ContestInfo;
} else {
data.config = contestOrConfig as RunConfig;
data.hidden = true;
}
}
const res = await coll.insertOne(data);

Loading…
Cancel
Save