mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: judge priority fix
This commit is contained in:
1 parent
880bbbf56f
commit
4c80aa888e
2 files changed
+3
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.23.17",
|
"version": "2.23.18",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class RecordModel {
|
|||||||
const pending = await task.count({ uid });
|
const pending = await task.count({ uid });
|
||||||
const timeRecent = await RecordModel.coll
|
const timeRecent = await RecordModel.coll
|
||||||
.find({ _id: { $gte: Time.getObjectID(moment().add(-1, 'hour')) }, uid }).project({ time: 1 }).toArray();
|
.find({ _id: { $gte: Time.getObjectID(moment().add(-1, 'hour')) }, uid }).project({ time: 1 }).toArray();
|
||||||
return -(pending * (sum(timeRecent.map((i) => i.time || 0)) / 1000));
|
return -(pending * (sum(timeRecent.map((i) => i.time || 0)) / 100000));
|
||||||
}
|
}
|
||||||
|
|
||||||
static async get(domainId: string, _id: ObjectID): Promise<Rdoc | null> {
|
static async get(domainId: string, _id: ObjectID): Promise<Rdoc | null> {
|
||||||
@@ -95,7 +95,7 @@ class RecordModel {
|
|||||||
const res = await RecordModel.coll.insertOne(data);
|
const res = await RecordModel.coll.insertOne(data);
|
||||||
if (addTask) {
|
if (addTask) {
|
||||||
const priority = await RecordModel.submissionPriority(uid);
|
const priority = await RecordModel.submissionPriority(uid);
|
||||||
await RecordModel.judge(domainId, res.insertedId, 1 - priority);
|
await RecordModel.judge(domainId, res.insertedId, 1 + priority);
|
||||||
}
|
}
|
||||||
return res.insertedId;
|
return res.insertedId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user