mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
record_detail autoupdate
This commit is contained in:
1 parent
3a90e2893f
commit
c68953c59f
17 files changed
+209
-278
No files matched your search
@@ -1,9 +1,10 @@
|
||||
const
|
||||
{ GET, POST } = require('../service/server'),
|
||||
queue = require('../service/queue'),
|
||||
record = require('../model/record'),
|
||||
{ requirePerm } = require('./tools'),
|
||||
{ PERM_JUDGE } = require('../permission');
|
||||
{ PERM_JUDGE } = require('../permission'),
|
||||
record = require('../model/record'),
|
||||
bus = require('../service/bus'),
|
||||
queue = require('../service/queue'),
|
||||
{ GET, POST } = require('../service/server');
|
||||
|
||||
queue.assert('judge');
|
||||
|
||||
@@ -46,7 +47,8 @@ POST('/judge/next', requirePerm(PERM_JUDGE), async ctx => {
|
||||
if (body.score) $set.score = body.score;
|
||||
if (body.time_ms) $set.time = body.time_ms;
|
||||
if (body.memory_kb) $set.memory = body.memory_kb;
|
||||
await record.update(body.rid, $set);
|
||||
rdoc = await record.update(body.rid, $set);
|
||||
bus.publish('record_change', rdoc);
|
||||
ctx.body = {};
|
||||
});
|
||||
POST('/judge/end', requirePerm(PERM_JUDGE), async ctx => {
|
||||
@@ -71,6 +73,7 @@ POST('/judge/end', requirePerm(PERM_JUDGE), async ctx => {
|
||||
if (body.memory_kb) $set.memory = body.memory_kb;
|
||||
$set.judgeAt = new Date();
|
||||
$set.judger = ctx.state.user._id;
|
||||
await record.update(body.rid, $set);
|
||||
rdoc = await record.update(body.rid, $set);
|
||||
bus.publish('record_change', rdoc);
|
||||
ctx.body = {};
|
||||
});
|
||||
Reference in new issue
Block a user