judge: use addProgress instead of progress

This commit is contained in:
undefined committed 2022-02-10 13:11:05 +08:00
1 parent 5182031bca
commit 8810ccd285
12 files changed
+20 -16

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.4.14",
"version": "3.4.15",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+1 -1
View File
@@ -71,7 +71,7 @@ export async function next(body: JudgeResultBody) {
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(rdoc.domainId, body.rid, $set, $push);
rdoc = await record.update(rdoc.domainId, body.rid, $set, $push, {}, body.addProgress ? { progress: body.progress } : {});
bus.broadcast('record/change', rdoc!, $set, $push);
}
+1
View File
@@ -521,6 +521,7 @@ export interface JudgeResultBody {
rid: ObjectID;
judger?: number;
progress?: number;
addProgress?: number;
case?: {
id?: number;
status: number;
+3 -1
View File
@@ -12,7 +12,7 @@ import {
} from '../interface';
import * as bus from '../service/bus';
import db from '../service/db';
import { MaybeArray } from '../typeutils';
import { MaybeArray, NumberKeys } from '../typeutils';
import { ArgMethod, buildProjection, Time } from '../utils';
import { STATUS } from './builtin';
import problem from './problem';
@@ -146,11 +146,13 @@ class RecordModel {
$set?: MatchKeysAndValues<RecordDoc>,
$push?: PushOperator<RecordDoc>,
$unset?: OnlyFieldsOfType<RecordDoc, any, true | '' | 1>,
$inc?: Partial<Record<NumberKeys<RecordDoc>, number>>,
): Promise<RecordDoc | null> {
const $update: UpdateQuery<RecordDoc> = {};
if ($set && Object.keys($set).length) $update.$set = $set;
if ($push && Object.keys($push).length) $update.$push = $push;
if ($unset && Object.keys($unset).length) $update.$unset = $unset;
if ($inc && Object.keys($inc).length) $update.$inc = $inc;
if (_id instanceof Array) {
await RecordModel.coll.updateMany({ _id: { $in: _id }, domainId }, $update);
return null;