core: submissionPriority: count STATUS_JUDGING

This commit is contained in:
undefined committed 2022-08-01 19:10:58 +08:00
1 parent a44e744a28
commit 58ab74fcfc
2 files changed
+5 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.15.0",
"version": "3.15.1",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+4 -2
View File
@@ -27,9 +27,11 @@ class RecordModel {
];
static async submissionPriority(uid: number, base: number = 0) {
const pending = await task.count({ uid, rejudged: { $ne: true } });
const timeRecent = await RecordModel.coll
.find({ _id: { $gte: Time.getObjectID(moment().add(-30, 'minutes')) }, uid }).project({ time: 1 }).toArray();
.find({ _id: { $gte: Time.getObjectID(moment().add(-30, 'minutes')) }, uid }).project({ time: 1, status: 1 }).toArray();
const pending = timeRecent.filter((i) => [
STATUS.STATUS_FETCHED, STATUS.STATUS_COMPILING, STATUS.STATUS_JUDGING,
].includes(i.status)).length;
return base - ((pending * 1000 + 1) * (sum(timeRecent.map((i) => i.time || 0)) / 10000) + 1);
}