mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修复无法根据contest_id查找评测记录的问题
This commit is contained in:
1 parent
ee0f5deedc
commit
a1c42af7a7
3 files changed
+10
-6
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.13.41",
|
||||
"version": "2.13.42",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -23,7 +23,6 @@ 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';
|
||||
if (tid) tid = new ObjectID(tid);
|
||||
const q: any = { tid, hidden: false };
|
||||
if (uidOrName) {
|
||||
q.$or = [
|
||||
@@ -171,11 +170,11 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
|
||||
dispose: bus.Disposable;
|
||||
|
||||
@param('tid', Types.ObjectID, true)
|
||||
async prepare(domainId: string, tid: ObjectID) {
|
||||
async prepare(domainId: string, tid?: ObjectID) {
|
||||
this.domainId = domainId;
|
||||
if (tid) {
|
||||
const tdoc = await contest.get(domainId, new ObjectID(tid), -1);
|
||||
if (this.canShowRecord(tdoc)) this.tid = tid;
|
||||
const tdoc = await contest.get(domainId, tid, -1);
|
||||
if (this.canShowRecord(tdoc)) this.tid = tid.toHexString();
|
||||
else {
|
||||
this.close();
|
||||
return;
|
||||
|
||||
@@ -425,16 +425,21 @@ export class Handler {
|
||||
url(name: string, kwargs: any = {}) {
|
||||
let res = '#';
|
||||
const args: any = {};
|
||||
const query: any = {};
|
||||
for (const key in kwargs) {
|
||||
if (kwargs[key] instanceof ObjectID) args[key] = kwargs[key].toHexString();
|
||||
else args[key] = kwargs[key].toString();
|
||||
}
|
||||
for (const key in kwargs.query || {}) {
|
||||
if (query[key] instanceof ObjectID) query[key] = kwargs.query[key].toHexString();
|
||||
else query[key] = kwargs.query[key].toString();
|
||||
}
|
||||
try {
|
||||
if (this.domainId !== 'system' || args.domainId) {
|
||||
name += '_with_domainId';
|
||||
args.domainId = args.domainId || this.domainId;
|
||||
}
|
||||
const { anchor, query } = args;
|
||||
const { anchor } = args;
|
||||
if (query) res = router.url(name, args, { query });
|
||||
else res = router.url(name, args);
|
||||
if (anchor) return `${res}#${anchor}`;
|
||||
|
||||
Reference in new issue
Block a user