util: fix score calculation

pull/375/head
undefined 2 years ago
parent cb18ec19fe
commit b367069050

@ -11,5 +11,8 @@
"search.exclude": { "search.exclude": {
"**/.yarn": true, "**/.yarn": true,
"**/.pnp.*": true "**/.pnp.*": true
},
"files.associations": {
"*.html": "nunjucks"
} }
} }

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

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

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

@ -205,7 +205,7 @@ const SubtaskMatcher: MatchRule[] = [
function* getScore(totalScore: number, count: number) { function* getScore(totalScore: number, count: number) {
const base = Math.floor(totalScore / count); const base = Math.floor(totalScore / count);
const extra = count - (100 % count); const extra = count - (totalScore % count);
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
if (i >= extra) yield base + 1; if (i >= extra) yield base + 1;
else yield base; else yield base;

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

Loading…
Cancel
Save