judge: bug fixes

pull/546/head
undefined 2 years ago
parent 328b5c6690
commit 5b0878b59e
No known key found for this signature in database

@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "3.1.22",
"version": "3.1.23",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",

@ -42,7 +42,7 @@ interface Args {
key: string;
isSelfSubmission: boolean;
lang: string;
langConfig: LangConfig;
langConfig?: LangConfig;
}
export default async function readCases(folder: string, cfg: ProblemConfigFile = {}, args: Args): Promise<ParsedConfig> {
@ -68,8 +68,8 @@ export default async function readCases(folder: string, cfg: ProblemConfigFile =
} catch (e) {
throw changeErrorType(e, FormatError);
}
const timeRate = +(config.time_limit_rate?.[args.lang] || args.langConfig.time_limit_rate) || 1;
const memoryRate = +(config.memory_limit_rate?.[args.lang] || args.langConfig.memory_limit_rate) || 1;
const timeRate = +(config.time_limit_rate?.[args.lang] || args.langConfig?.time_limit_rate || 1) || 1;
const memoryRate = +(config.memory_limit_rate?.[args.lang] || args.langConfig?.memory_limit_rate || 1) || 1;
const checkFile = ensureFile(folder);
const result = await readYamlCases(config, checkFile)
.catch((e) => { throw changeErrorType(e, FormatError); });

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "4.9.5",
"version": "4.9.6",
"bin": "bin/hydrooj.js",
"main": "src/plugin-api",
"module": "src/plugin-api",

@ -70,6 +70,7 @@ export default class RecordModel {
let data: FileInfo[] = [];
let source = `${domainId}/${rdoc.pid}`;
meta = { ...meta, problemOwner: 1 };
await task.deleteMany({ rid: { $in: rids } });
if (rdoc.pid) {
let pdoc = await problem.get(rdoc.domainId, rdoc.pid);
if (!pdoc) throw new ProblemNotFoundError(rdoc.domainId, rdoc.pid);
@ -81,8 +82,8 @@ export default class RecordModel {
source = `${pdoc.domainId}/${pdoc.docId}`;
data = pdoc.data;
if (typeof pdoc.config === 'string') throw new Error(pdoc.config);
config.type = pdoc.config.type as any;
if (pdoc.config.type === 'remote_judge' && rdoc.contest?.toHexString() !== '0'.repeat(24)) {
await task.deleteMany({ rid: { $in: rids } });
return await task.addMany(rids.map((rid) => ({
...(pdoc.config as any),
priority,
@ -94,7 +95,6 @@ export default class RecordModel {
} as any)));
}
}
await task.deleteMany({ rid: { $in: rids } });
return await task.addMany(rids.map((rid) => ({
priority,
type: 'judge',

Loading…
Cancel
Save