mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
修复分数为0时不会自动更新成绩的问题,添加旧版测试数据格式兼容
This commit is contained in:
1 parent
e1cfe1cf4d
commit
441515297a
7 files changed
+70
-32
No files matched your search
@@ -57,10 +57,10 @@ export async function next(body: JudgeResultBody) {
|
||||
$push.compilerTexts = body.compilerText;
|
||||
}
|
||||
if (body.status) $set.status = body.status;
|
||||
if (body.score) $set.score = body.score;
|
||||
if (body.time) $set.time = body.time;
|
||||
if (body.memory) $set.memory = body.memory;
|
||||
if (body.progress) $set.progress = body.progress;
|
||||
if (body.score !== undefined) $set.score = body.score;
|
||||
if (body.time !== undefined) $set.time = body.time;
|
||||
if (body.memory !== undefined) $set.memory = body.memory;
|
||||
if (body.progress !== undefined) $set.progress = body.progress;
|
||||
rdoc = await record.update(body.domainId, body.rid, $set, $push);
|
||||
bus.boardcast('record/change', rdoc, $set, $push);
|
||||
}
|
||||
@@ -80,11 +80,11 @@ export async function end(body: JudgeResultBody) {
|
||||
$push.compilerTexts = body.compilerText;
|
||||
}
|
||||
if (body.status) $set.status = body.status;
|
||||
if (body.score) $set.score = body.score;
|
||||
if (body.time) $set.time = body.time;
|
||||
if (body.memory) $set.memory = body.memory;
|
||||
if (body.score !== undefined) $set.score = body.score;
|
||||
if (body.time !== undefined) $set.time = body.time;
|
||||
if (body.memory !== undefined) $set.memory = body.memory;
|
||||
$set.judgeAt = new Date();
|
||||
$set.judger = body.judger;
|
||||
$set.judger = body.judger ?? 1;
|
||||
rdoc = await record.update(body.domainId, body.rid, $set, $push, $unset);
|
||||
await _postJudge(rdoc);
|
||||
bus.boardcast('record/change', rdoc); // trigger a full update
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import cluster from 'cluster';
|
||||
import { Db, FilterQuery } from 'mongodb';
|
||||
import { argv } from 'yargs';
|
||||
import { Logger } from '../logger';
|
||||
import {
|
||||
Mdoc, Pdoc, Rdoc, TrainingDoc, User,
|
||||
@@ -112,7 +113,7 @@ export function emit<K extends keyof EventMap>(name: K, ...args: Parameters<Even
|
||||
}
|
||||
|
||||
export async function serial<K extends keyof EventMap>(name: K, ...args: Parameters<EventMap[K]>): Promise<void> {
|
||||
logger.debug('serial: %s %o', name, args);
|
||||
if (argv.showBus) logger.debug('serial: %s %o', name, args);
|
||||
const hooks = Array.from(_hooks[name] || []);
|
||||
for (const callback of hooks) {
|
||||
await callback.apply(this, args);
|
||||
@@ -120,7 +121,7 @@ export async function serial<K extends keyof EventMap>(name: K, ...args: Paramet
|
||||
}
|
||||
|
||||
export function bail<K extends keyof EventMap>(name: K, ...args: Parameters<EventMap[K]>): ReturnType<EventMap[K]> {
|
||||
logger.debug('bail: %s %o', name, args);
|
||||
if (argv.showBus) logger.debug('bail: %s %o', name, args);
|
||||
const hooks = Array.from(_hooks[name] || []);
|
||||
for (const callback of hooks) {
|
||||
const result = callback.apply(this, args);
|
||||
|
||||
Reference in new issue
Block a user