core&ui: fix contest problem ref

pull/156/head
undefined 3 years ago
parent 7a9dc95377
commit 715e564971

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

@ -74,10 +74,10 @@ export class ContestDetailHandler extends Handler {
['contest_main', 'contest_main'],
[tdoc.title, null, null, true],
];
const index = tdoc.pids.map((i) => i.toString());
for (const key in pdict) {
// @ts-ignore
if (pdict[key].domainId !== domainId) pdict[key].docId = `${pdict[key].domainId}:${pdict[key].docId}`;
pdict[key].pid = (tdoc.pids.indexOf(pdict[key].docId) + 10).toString(36).toUpperCase();
const i = (index.indexOf(key) + 10).toString(36).toUpperCase();
if (i !== '9') pdict[key].pid = i;
}
this.response.body = {
path, tdoc, tsdoc, attended, udict, pdict, psdict, rdict, page,

@ -90,10 +90,10 @@ class HomeworkDetailHandler extends Handler {
['homework_main', 'homework_main'],
[tdoc.title, null, null, true],
];
const index = tdoc.pids.map((i) => i.toString());
for (const key in pdict) {
// @ts-ignore
if (pdict[key].domainId !== domainId) pdict[key].docId = `${pdict[key].domainId}:${pdict[key].docId}`;
pdict[key].pid = (tdoc.pids.indexOf(pdict[key].docId) + 10).toString(36).toUpperCase();
const i = (index.indexOf(key) + 10).toString(36).toUpperCase();
if (i !== '9') pdict[key].pid = i;
}
this.response.template = 'homework_detail.html';
this.response.body = {

@ -34,7 +34,6 @@ export async function parseConfig(config: string | ProblemConfigFile = {}) {
result.timeMax = result.timeMin = 1000;
}
if (cfg.langs) result.langs = cfg.langs;
console.log(result);
return result;
}

@ -17,7 +17,6 @@ import cache from 'koa-static-cache';
import sockjs from 'sockjs';
import cac from 'cac';
import { createHash } from 'crypto';
import type { SetOption } from 'cookies';
import * as bus from './bus';
import { errorMessage } from '../utils';
import { User, DomainDoc } from '../interface';
@ -611,7 +610,7 @@ export class Handler extends HandlerCommon {
} else {
[, this.session] = await token.add(token.TYPE_SESSION, expireSeconds, { ...this.session, ...$update, ...$create });
}
const cookie: SetOption = {
const cookie = {
secure: !!system.get('session.secure'),
httpOnly: false,
};

@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.11.9",
"version": "4.11.10",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",

@ -40,12 +40,10 @@ const page = new NamedPage('user_detail', async () => {
toolbox: {
right: 10,
feature: {
dataZoom: { yAxisIndex: 'none' },
restore: {},
saveAsImage: {},
},
},
dataZoom: [{ type: 'inside' }],
visualMap: {
show: false,
pieces: [{

@ -14,7 +14,7 @@
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.pid, tid=tdoc.docId)) }}
{{ set(UiContext, 'getSubmissionsUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.pid, tid=tdoc.docId)) }}
{{ set(UiContext, 'getRecordDetailUrl', url('record_detail', rid='{rid}', query={tid:tdoc.docId})) }}
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.docId + "&domainId=" + handler.domainId + "&tid=" + tdoc.docId) }}
{{ set(UiContext, 'pretestConnUrl', "/record-conn?pretest=1&uid=" + handler.user._id + "&pid=" + pdoc.domainId + ":" + pdoc.docId + "&domainId=" + handler.domainId + "&tid=" + tdoc.docId) }}
{% else %}
{{ set(UiContext, 'canViewRecord', true) }}
{{ set(UiContext, 'postSubmitUrl', url('problem_submit', pid=pdoc.docId)) }}

Loading…
Cancel
Save