mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: 修正比赛中的提交被标记为hidden的问题
This commit is contained in:
1 parent
58807c4148
commit
1afb022c32
3 files changed
+17
-9
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user