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",
|
"name": "hydrooj",
|
||||||
"version": "2.13.41",
|
"version": "2.13.42",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class RecordListHandler extends RecordHandler {
|
|||||||
@param('uidOrName', Types.String, true)
|
@param('uidOrName', Types.String, true)
|
||||||
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string) {
|
async get(domainId: string, page = 1, pid?: string, tid?: ObjectID, uidOrName?: string) {
|
||||||
this.response.template = 'record_main.html';
|
this.response.template = 'record_main.html';
|
||||||
if (tid) tid = new ObjectID(tid);
|
|
||||||
const q: any = { tid, hidden: false };
|
const q: any = { tid, hidden: false };
|
||||||
if (uidOrName) {
|
if (uidOrName) {
|
||||||
q.$or = [
|
q.$or = [
|
||||||
@@ -171,11 +170,11 @@ class RecordMainConnectionHandler extends RecordConnectionHandler {
|
|||||||
dispose: bus.Disposable;
|
dispose: bus.Disposable;
|
||||||
|
|
||||||
@param('tid', Types.ObjectID, true)
|
@param('tid', Types.ObjectID, true)
|
||||||
async prepare(domainId: string, tid: ObjectID) {
|
async prepare(domainId: string, tid?: ObjectID) {
|
||||||
this.domainId = domainId;
|
this.domainId = domainId;
|
||||||
if (tid) {
|
if (tid) {
|
||||||
const tdoc = await contest.get(domainId, new ObjectID(tid), -1);
|
const tdoc = await contest.get(domainId, tid, -1);
|
||||||
if (this.canShowRecord(tdoc)) this.tid = tid;
|
if (this.canShowRecord(tdoc)) this.tid = tid.toHexString();
|
||||||
else {
|
else {
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -425,16 +425,21 @@ export class Handler {
|
|||||||
url(name: string, kwargs: any = {}) {
|
url(name: string, kwargs: any = {}) {
|
||||||
let res = '#';
|
let res = '#';
|
||||||
const args: any = {};
|
const args: any = {};
|
||||||
|
const query: any = {};
|
||||||
for (const key in kwargs) {
|
for (const key in kwargs) {
|
||||||
if (kwargs[key] instanceof ObjectID) args[key] = kwargs[key].toHexString();
|
if (kwargs[key] instanceof ObjectID) args[key] = kwargs[key].toHexString();
|
||||||
else args[key] = kwargs[key].toString();
|
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 {
|
try {
|
||||||
if (this.domainId !== 'system' || args.domainId) {
|
if (this.domainId !== 'system' || args.domainId) {
|
||||||
name += '_with_domainId';
|
name += '_with_domainId';
|
||||||
args.domainId = args.domainId || this.domainId;
|
args.domainId = args.domainId || this.domainId;
|
||||||
}
|
}
|
||||||
const { anchor, query } = args;
|
const { anchor } = args;
|
||||||
if (query) res = router.url(name, args, { query });
|
if (query) res = router.url(name, args, { query });
|
||||||
else res = router.url(name, args);
|
else res = router.url(name, args);
|
||||||
if (anchor) return `${res}#${anchor}`;
|
if (anchor) return `${res}#${anchor}`;
|
||||||
|
|||||||
Reference in new issue
Block a user