mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: use addProgress instead of progress
This commit is contained in:
1 parent
5182031bca
commit
8810ccd285
12 files changed
+20
-16
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -521,6 +521,7 @@ export interface JudgeResultBody {
|
||||
rid: ObjectID;
|
||||
judger?: number;
|
||||
progress?: number;
|
||||
addProgress?: number;
|
||||
case?: {
|
||||
id?: number;
|
||||
status: number;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user