mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: submissionPriority for rejudge
This commit is contained in:
1 parent
8223b45d23
commit
250ae863d0
4 files changed
+10
-7
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.5.6",
|
"version": "3.5.7",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -380,10 +380,13 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
async postRejudge(domainId: string, pid: number) {
|
async postRejudge(domainId: string, pid: number) {
|
||||||
this.checkPerm(PERM.PERM_REJUDGE_PROBLEM);
|
this.checkPerm(PERM.PERM_REJUDGE_PROBLEM);
|
||||||
// TODO maybe async?
|
// TODO maybe async?
|
||||||
await record.getMulti(domainId, { pid }).forEach(async (doc) => {
|
const rdocs = await record.getMulti(domainId, { pid, contest: { $ne: new ObjectID('0'.repeat(24)) } })
|
||||||
await record.reset(domainId, doc._id, true);
|
.project({ _id: 1 }).toArray();
|
||||||
await record.judge(domainId, doc._id, -50);
|
const priority = await record.submissionPriority(this.user._id, -rdocs.length * 5 - 50);
|
||||||
});
|
await Promise.all(rdocs.map(
|
||||||
|
(doc) => record.reset(domainId, doc._id, true)
|
||||||
|
.then(() => record.judge(domainId, doc._id, priority)),
|
||||||
|
));
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,10 +144,11 @@ class RecordDetailHandler extends Handler {
|
|||||||
@param('rid', Types.ObjectID)
|
@param('rid', Types.ObjectID)
|
||||||
async postRejudge(domainId: string, rid: ObjectID) {
|
async postRejudge(domainId: string, rid: ObjectID) {
|
||||||
this.checkPerm(PERM.PERM_REJUDGE);
|
this.checkPerm(PERM.PERM_REJUDGE);
|
||||||
|
const priority = await record.submissionPriority(this.user._id, -20);
|
||||||
const rdoc = await record.get(domainId, rid);
|
const rdoc = await record.get(domainId, rid);
|
||||||
if (rdoc) {
|
if (rdoc) {
|
||||||
await record.reset(domainId, rid, true);
|
await record.reset(domainId, rid, true);
|
||||||
await record.judge(domainId, rid, -10);
|
await record.judge(domainId, rid, priority);
|
||||||
}
|
}
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const path = require('path');
|
|||||||
const yaml = require('js-yaml');
|
const yaml = require('js-yaml');
|
||||||
const serialize = require('serialize-javascript');
|
const serialize = require('serialize-javascript');
|
||||||
const nunjucks = require('nunjucks');
|
const nunjucks = require('nunjucks');
|
||||||
const { filter } = require('lodash');
|
|
||||||
const jsesc = require('jsesc');
|
const jsesc = require('jsesc');
|
||||||
const argv = require('cac')().parse();
|
const argv = require('cac')().parse();
|
||||||
const { findFileSync } = require('@hydrooj/utils/lib/utils');
|
const { findFileSync } = require('@hydrooj/utils/lib/utils');
|
||||||
|
|||||||
Reference in new issue
Block a user