mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: handle isContest
This commit is contained in:
1 parent
649cc21f12
commit
d57442bf5f
3 files changed
+6
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.39.10",
|
||||
"version": "2.39.11",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -381,7 +381,7 @@ export class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
||||
throw new BadRequestError('Language not allowed.');
|
||||
}
|
||||
await this.limitRate('add_record', 60, system.get('limit.submission'));
|
||||
const rid = await record.add(domainId, pid, this.user._id, lang, code, true, pretest ? input : tid);
|
||||
const rid = await record.add(domainId, pid, this.user._id, lang, code, true, pretest ? input : tid, !pretest);
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
if (!rdoc) throw new RecordNotFoundError(domainId, rid);
|
||||
if (!pretest) {
|
||||
|
||||
@@ -97,7 +97,7 @@ class RecordModel {
|
||||
|
||||
static async add(
|
||||
domainId: string, pid: ExternalProblemId | number, uid: number,
|
||||
lang: string, code: string, addTask: boolean, contestOrConfig?: ObjectID | string,
|
||||
lang: string, code: string, addTask: boolean, tidOrInput?: ObjectID | string, isContest?: boolean
|
||||
) {
|
||||
let pdomain = domainId;
|
||||
if (typeof pid === 'string') {
|
||||
@@ -123,15 +123,11 @@ class RecordModel {
|
||||
judgeAt: null,
|
||||
rejudged: false,
|
||||
};
|
||||
let isContest = false;
|
||||
if (typeof contestOrConfig === 'string') {
|
||||
if (typeof tidOrInput === 'string') {
|
||||
// is Run
|
||||
data.input = contestOrConfig;
|
||||
data.input = tidOrInput;
|
||||
data.contest = new ObjectID('000000000000000000000000');
|
||||
} else {
|
||||
data.contest = contestOrConfig;
|
||||
isContest = true;
|
||||
}
|
||||
} else data.contest = tidOrInput;
|
||||
const res = await RecordModel.coll.insertOne(data);
|
||||
if (addTask) {
|
||||
const priority = await RecordModel.submissionPriority(uid, isContest ? 50 : 0);
|
||||
|
||||
Reference in new issue
Block a user