mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: remote judge api
This commit is contained in:
1 parent
939584ec5e
commit
680e3ccd32
11 files changed
+54
-13
No files matched your search
@@ -39,7 +39,7 @@ export class ProblemModel {
|
||||
domainId: 'system',
|
||||
docType: document.TYPE_PROBLEM,
|
||||
docId: 0,
|
||||
pid: null,
|
||||
pid: '',
|
||||
owner: 1,
|
||||
title: '*',
|
||||
content: '',
|
||||
|
||||
@@ -9,7 +9,7 @@ import { STATUS } from './builtin';
|
||||
import task from './task';
|
||||
import problem from './problem';
|
||||
import {
|
||||
RecordDoc, ContestInfo, ProblemConfigFile, ExternalProblemId,
|
||||
RecordDoc, ContestInfo, ProblemConfigFile, ExternalProblemId, ProblemConfig,
|
||||
} from '../interface';
|
||||
import { ArgMethod, buildProjection, Time } from '../utils';
|
||||
import { MaybeArray } from '../typeutils';
|
||||
@@ -62,11 +62,25 @@ class RecordModel {
|
||||
static async judge(domainId: string, rid: ObjectID, priority = 0, config: ProblemConfigFile = {}) {
|
||||
const rdoc = await RecordModel.get(domainId, rid);
|
||||
let data = [];
|
||||
delete rdoc._id;
|
||||
if (rdoc.pid) {
|
||||
const pdoc = await problem.get(rdoc.pdomain, rdoc.pid);
|
||||
data = pdoc.data;
|
||||
if (typeof pdoc.config === 'string') throw new Error(); // Just for typings. This won't happen.
|
||||
if (pdoc.config.type === 'remote_judge') {
|
||||
return await task.add({
|
||||
...rdoc,
|
||||
priority,
|
||||
type: 'remotejudge',
|
||||
subType: pdoc.config.subType,
|
||||
target: pdoc.config.target,
|
||||
rid,
|
||||
domainId,
|
||||
config,
|
||||
data,
|
||||
});
|
||||
}
|
||||
}
|
||||
delete rdoc._id;
|
||||
await task.add({
|
||||
...rdoc,
|
||||
priority,
|
||||
|
||||
@@ -140,6 +140,7 @@ DomainSetting(
|
||||
Setting('setting_domain', 'avatar', '', 'text', 'avatar', 'Will be used as the domain icon.'),
|
||||
Setting('setting_domain', 'share', '', 'text', 'Share problem with domain (* for any)'),
|
||||
Setting('setting_domain', 'bulletin', '', 'markdown', 'Bulletin'),
|
||||
Setting('setting_domain', 'langs', '', 'text', 'Allowed langs', null),
|
||||
Setting('setting_storage', 'host', '', 'text', 'Custom host', null, FLAG_HIDDEN | FLAG_DISABLED),
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user