utils: fix normalizeSubtasks score (#356)

milkdown
panda 2 years ago committed by GitHub
parent a585c13a72
commit 842322d15c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.20.0",
"version": "2.20.1",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.13.5",
"version": "3.13.6",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",

@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.37.2",
"version": "4.37.3",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",

@ -284,25 +284,25 @@ export function normalizeSubtasks(
return subtasks.map((s) => {
id++;
s.cases.sort((a, b) => (a.id - b.id));
const score = subtaskScore.next().value as number;
const score = s.score || subtaskScore.next().value as number;
const caseScore = getScore(
Math.max(score - Math.sum(s.cases.map((i) => i.score || 0)), 0),
s.cases.filter((i) => !i.score).length,
);
return {
id,
score,
type: 'min',
if: [],
...s,
score,
time: parseTimeMS(s.time || time, !ignoreParseError),
memory: parseMemoryMB(s.memory || memory, !ignoreParseError),
cases: s.cases.map((c) => {
count++;
return {
id: count,
score: s.type === 'sum' ? caseScore.next().value as number : score,
...c,
score: c.score || (s.type === 'sum' ? caseScore.next().value as number : score),
time: parseTimeMS(c.time || s.time || time, !ignoreParseError),
memory: parseMemoryMB(c.memory || s.memory || memory, !ignoreParseError),
input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : '/dev/null',

@ -1,6 +1,6 @@
{
"name": "@hydrooj/utils",
"version": "1.2.4",
"version": "1.2.5",
"description": "hydrooj utils",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",

Loading…
Cancel
Save