mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: remove pdoc.config (use config.yaml instead)
This commit is contained in:
1 parent
6fbb7588e1
commit
d1e119fe7f
7 files changed
+53
-29
No files matched your search
@@ -6,6 +6,7 @@ import superagent from 'superagent';
|
||||
import { filter } from 'lodash';
|
||||
import { PassThrough } from 'stream';
|
||||
import AdmZip from 'adm-zip';
|
||||
import yaml from 'js-yaml';
|
||||
import { ValidationError, RemoteOnlineJudgeError } from '../error';
|
||||
import { Logger } from '../logger';
|
||||
import type { ContentNode } from '../interface';
|
||||
@@ -115,14 +116,13 @@ class ProblemImportSYZOJHandler extends Handler {
|
||||
await problem.addTestdata(domainId, docId, entry.entryName, entry.getData());
|
||||
}
|
||||
const filename = p.file_io_input_name ? p.file_io_input_name?.split('.')[0] : null;
|
||||
await problem.edit(domainId, docId, {
|
||||
config: {
|
||||
time: `${p.time_limit}ms`,
|
||||
memory: `${p.memory_limit}m`,
|
||||
filename,
|
||||
type: p.type === 'traditional' ? 'default' : p.type,
|
||||
},
|
||||
});
|
||||
const config = {
|
||||
time: `${p.time_limit}ms`,
|
||||
memory: `${p.memory_limit}m`,
|
||||
filename,
|
||||
type: p.type === 'traditional' ? 'default' : p.type,
|
||||
};
|
||||
await problem.addTestdata(domainId, docId, 'config.yaml', Buffer.from(yaml.dump(config)));
|
||||
} finally {
|
||||
fs.unlinkSync(file);
|
||||
}
|
||||
@@ -188,13 +188,12 @@ class ProblemImportSYZOJHandler extends Handler {
|
||||
await problem.addTestdata(domainId, docId, f.filename, p);
|
||||
}
|
||||
if (judge) {
|
||||
await problem.edit(domainId, docId, {
|
||||
config: {
|
||||
time: `${judge.timeLimit}ms`,
|
||||
memory: `${judge.memoryLimit}m`,
|
||||
// TODO other config
|
||||
},
|
||||
});
|
||||
const config = {
|
||||
time: `${judge.timeLimit}ms`,
|
||||
memory: `${judge.memoryLimit}m`,
|
||||
// TODO other config
|
||||
};
|
||||
await problem.addTestdata(domainId, docId, 'config.yaml', Buffer.from(yaml.dump(config)));
|
||||
}
|
||||
const a = await superagent.post(`${protocol}://${host === 'loj.ac' ? 'api.loj.ac.cn' : host}/api/problem/downloadProblemFiles`)
|
||||
.send({
|
||||
|
||||
@@ -358,9 +358,6 @@ export class ProblemSettingsHandler extends ProblemManageHandler {
|
||||
[this.pdoc.title, 'problem_detail', { pid }, true],
|
||||
['problem_settings', null],
|
||||
];
|
||||
if (this.response.body.pdoc.config) {
|
||||
this.response.body.pdoc.config = yaml.dump(this.response.body.pdoc.config);
|
||||
}
|
||||
}
|
||||
|
||||
@param('pid', Types.String, null, parsePid)
|
||||
|
||||
Reference in new issue
Block a user