mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 09: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
@@ -6,7 +6,7 @@
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"maxmind": "^4.3.4"
|
||||
"maxmind": "^4.3.5"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.13.0",
|
||||
"version": "2.13.1",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"dependencies": {
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"axios": "^0.24.0",
|
||||
"axios": "^0.25.0",
|
||||
"cac": "^6.7.12",
|
||||
"esbuild": "0.14.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
@@ -16,7 +16,7 @@
|
||||
"mongodb": "^3.7.3",
|
||||
"p-queue": "^7.2.0",
|
||||
"shell-quote": "^1.7.3",
|
||||
"ws": "^8.4.2"
|
||||
"ws": "^8.5.0"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"license": "AGPL-3.0-or-later",
|
||||
|
||||
@@ -31,7 +31,7 @@ function judgeCase(c: Case, sid: string) {
|
||||
memory_kb: 0,
|
||||
message: '',
|
||||
},
|
||||
progress: Math.floor((c.id * 100) / ctx.config.count),
|
||||
addProgress: 100 / ctx.config.count,
|
||||
}, c.id);
|
||||
return;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ function judgeCase(c: Case, sid: string) {
|
||||
memory_kb: memory_usage_kb,
|
||||
message,
|
||||
},
|
||||
progress: Math.floor((c.id * 100) / ctx.config.count),
|
||||
addProgress: 100 / ctx.config.count,
|
||||
}, c.id);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface JudgeTaskInterface {
|
||||
status?: number;
|
||||
message?: string;
|
||||
progress?: number;
|
||||
addProgress?: number;
|
||||
case?: {
|
||||
status: number;
|
||||
score?: number;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.4.14",
|
||||
"version": "3.4.15",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"build": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mysql": "^2.15.20"
|
||||
"@types/mysql": "^2.15.21"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blueprintjs/core": "^3.52.0",
|
||||
"@blueprintjs/core": "^3.53.0",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"@types/gulp-if": "^0.0.34",
|
||||
"@types/jquery": "^3.5.13",
|
||||
@@ -25,7 +25,7 @@
|
||||
"chalk": "^4.1.2",
|
||||
"classnames": "^2.3.1",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"clipboard": "^2.0.9",
|
||||
"clipboard": "^2.0.10",
|
||||
"copy-webpack-plugin": "^6.4.1",
|
||||
"css-loader": "^4.3.0",
|
||||
"diff-dom": "^4.2.3",
|
||||
@@ -42,7 +42,7 @@
|
||||
"fancy-log": "^1.3.3",
|
||||
"file-loader": "^6.2.0",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"graphiql": "^1.5.16",
|
||||
"graphiql": "^1.5.17",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-cli": "^2.3.0",
|
||||
"gulp-iconfont": "^11.0.1",
|
||||
@@ -117,7 +117,7 @@
|
||||
"markdown-it-table-of-contents": "^0.6.0",
|
||||
"mongodb": "^3.7.3",
|
||||
"nunjucks": "^3.2.3",
|
||||
"react-query": "^3.34.12",
|
||||
"react-query": "^3.34.14",
|
||||
"streamsaver": "^2.0.5",
|
||||
"xss": "^1.0.10"
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"js-yaml": "^4.1.0",
|
||||
"moment": "^2.29.1",
|
||||
"mongodb": "^3.7.3",
|
||||
"systeminformation": "^5.11.0"
|
||||
"systeminformation": "^5.11.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"chrome-finder": "^1.0.7",
|
||||
"jsdom": "^19.0.0",
|
||||
"lodash": "^4.17.21",
|
||||
"puppeteer-core": "^13.1.3",
|
||||
"puppeteer-core": "^13.2.0",
|
||||
"puppeteer-extra": "^3.2.3",
|
||||
"puppeteer-extra-plugin-portal": "^3.0.1",
|
||||
"puppeteer-extra-plugin-stealth": "^2.9.0",
|
||||
|
||||
Reference in new issue
Block a user