core: remove getTestdata option

This commit is contained in:
undefined committed 2023-02-12 16:20:50 +08:00
1 parent 0200c7b168
commit 254f659f0a
3 files changed
+12 -13

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "4.7.3",
"version": "4.7.4",
"bin": "bin/hydrooj.js",
"main": "src/plugin-api",
"module": "src/plugin-api",
+3 -3
View File
@@ -282,7 +282,7 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler {
async exportGhost(domainId: string, tid: ObjectID) {
const tdoc = this.tdoc;
const [pdict, teams] = await Promise.all([
problem.getList(domainId, tdoc.pids, true, false, undefined, true),
problem.getList(domainId, tdoc.pids, true, false, problem.PROJECTION_LIST, true),
contest.getMultiStatus(domainId, { docId: tid }).toArray(),
]);
const udict = await user.getList(domainId, teams.map((i) => i.uid));
@@ -309,7 +309,7 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler {
`@teams ${tdoc.attend}`,
`@submissions ${submissions.length}`,
].concat(
tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i].title)},20,0`),
tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i]?.title || 'Unknown Problem')},20,0`),
teams.map((i, idx) => `@t ${idx + 1},0,1,${escape(udict[i.uid].school || unknownSchool)}-${escape(udict[i.uid].uname)}`),
submissions,
);
@@ -395,7 +395,7 @@ export class ContestEditHandler extends Handler {
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string, duration: number,
title: string, content: string, rule: string, _pids: string, rated = false,
_code = '', autoHide = false, assign: string[] = null, lock: number = null,
contestDuration: number = null, maintainer: number[] = null, allowViewCode = true,
contestDuration: number = null, maintainer: number[] = null, allowViewCode = false,
) {
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
+8 -9
View File
@@ -666,23 +666,22 @@ export class ProblemConfigHandler extends ProblemManageHandler {
export class ProblemFilesHandler extends ProblemDetailHandler {
notUsage = true;
@param('testdata', Types.Boolean)
@param('additional_file', Types.Boolean)
@param('pjax', Types.Boolean)
@param('sidebar', Types.Boolean)
async get(domainId: string, getTestdata = true, getAdditionalFile = true, pjax = false, sidebar = false) {
this.response.body.testdata = getTestdata ? sortFiles(this.pdoc.data || []) : [];
this.response.body.reference = getTestdata ? this.pdoc.reference : '';
this.response.body.additional_file = getAdditionalFile ? sortFiles(this.pdoc.additional_file || []) : [];
async get(domainId: string, pjax = false, sidebar = false) {
this.response.body.testdata = sortFiles(this.pdoc.data || []);
this.response.body.reference = this.pdoc.reference;
this.response.body.additional_file = sortFiles(this.pdoc.additional_file || []);
if (pjax) {
const { testdata, additional_file } = this.response.body;
const owner = await user.getById(domainId, this.pdoc.owner);
const args = {
testdata, additional_file, pdoc: this.pdoc, owner_udoc: owner, sidebar,
};
const tasks = [];
if (getTestdata) tasks.push(this.renderHTML('partials/problem_files.html', { ...args, filetype: 'testdata' }));
if (getAdditionalFile) tasks.push(this.renderHTML('partials/problem_files.html', { ...args, filetype: 'additional_file' }));
const tasks = [
this.renderHTML('partials/problem_files.html', { ...args, filetype: 'testdata' }),
this.renderHTML('partials/problem_files.html', { ...args, filetype: 'additional_file' }),
];
if (!sidebar) tasks.push(this.renderHTML('partials/problem-sidebar-information.html', args));
this.response.body = {
fragments: (await Promise.all(tasks)).map((i) => ({ html: i })),