From 6d7ed685d9ea7258426089e0fe4cb630ea0b1ab5 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:29:59 +0000 Subject: [PATCH 1/3] Add tests for score utils returning the right grade in edge cases --- .../framework/common/score-utils.test.ts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 server/src/lib/score-import/framework/common/score-utils.test.ts diff --git a/server/src/lib/score-import/framework/common/score-utils.test.ts b/server/src/lib/score-import/framework/common/score-utils.test.ts new file mode 100644 index 000000000..dab0021ea --- /dev/null +++ b/server/src/lib/score-import/framework/common/score-utils.test.ts @@ -0,0 +1,33 @@ +import t from "tap"; +import { GetGradeFromPercent } from "./score-utils"; + +t.test("#GetGradeForPercent", (t) => { + t.equal( + GetGradeFromPercent("chunithm", "Single", 101), + "SSS", + "Should return SSS for the edge case of chunithms 101% == SS." + ); + t.equal( + GetGradeFromPercent("iidx", "SP", 100), + "MAX", + "Should return SSS for the edge case of 100% == MAX (iidx SP)." + ); + t.equal( + GetGradeFromPercent("iidx", "DP", 100), + "MAX", + "Should return SSS for the edge case of 100% == MAX (iidx DP)." + ); + + t.equal( + GetGradeFromPercent("iidx", "SP", 0), + "F", + "Should return SSS for the edge case of 0% == F (iidx SP)." + ); + t.equal( + GetGradeFromPercent("iidx", "DP", 0), + "F", + "Should return SSS for the edge case of 0% == F (iidx DP)." + ); + + t.end(); +}); From 65530aa29ad5816ad9ba1ce0aa7d8aaa20b90d7a Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:30:23 +0000 Subject: [PATCH 2/3] Update tachi-common to fix a bug with chunithm SSS grades and update versions. --- server/package.json | 4 ++-- server/pnpm-lock.yaml | 8 ++++---- server/src/lib/constants/version.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/package.json b/server/package.json index 01887429d..a093077e2 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "tachi-server", - "version": "2.0.10", + "version": "2.0.13", "description": "A score tracking server.", "main": "js/index.js", "private": true, @@ -83,7 +83,7 @@ "rimraf": "3.0.2", "safe-json-stringify": "1.2.0", "seq-logging": "^1.1.1", - "tachi-common": "0.3.21", + "tachi-common": "0.3.22", "ts-node": "10.0.0", "typescript": "4.3.4", "winston": "3.3.3", diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index c2b70ddc0..8bea94550 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -63,7 +63,7 @@ specifiers: safe-json-stringify: 1.2.0 seq-logging: ^1.1.1 supertest: 6.1.3 - tachi-common: 0.3.21 + tachi-common: 0.3.22 tap: 15.0.9 ts-node: 10.0.0 tsconfig-paths: 3.10.1 @@ -107,7 +107,7 @@ dependencies: rimraf: 3.0.2 safe-json-stringify: 1.2.0 seq-logging: 1.1.1 - tachi-common: 0.3.21 + tachi-common: 0.3.22 ts-node: 10.0.0_83f53b0a0c5616d3fa00ed4e30b9ce1b typescript: 4.3.4 winston: 3.3.3 @@ -5387,8 +5387,8 @@ packages: strip-ansi: 6.0.0 dev: true - /tachi-common/0.3.21: - resolution: {integrity: sha512-gOaqyEMLrDr0xpmtVqjAYqdY+NgbpaVHZlt0g0v+nmKDMG9gyrqd99alUApUb/o0zzLd8o2uediajgWGcDTCFw==} + /tachi-common/0.3.22: + resolution: {integrity: sha512-nLt1wv65wY5WdB/QXuVNeOOgA8r2c8OrohGEKyylE5wRyWIA8wOVsZJGPxi9Uxm0TqeVDXwBRV8CyV97czZAMA==} dependencies: monk: 7.3.4 transitivePeerDependencies: diff --git a/server/src/lib/constants/version.ts b/server/src/lib/constants/version.ts index 851ef7778..379912495 100644 --- a/server/src/lib/constants/version.ts +++ b/server/src/lib/constants/version.ts @@ -4,7 +4,7 @@ const MAJOR = 2; const MINOR = 0; -const PATCH = 10; +const PATCH = 13; // As is with all front-facing zkldi projects, the version names for tachi-server // are from an album I like. In this case, the album is Portishead - Dummy. From 9e170f02961e326ca3c4822c575da32d1c50a80c Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Fri, 17 Dec 2021 00:56:44 +0000 Subject: [PATCH 3/3] Make the chunithm script point at null grades, not just SS grades. --- server/scripts/single-use/recalc-chunithm-scores.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/scripts/single-use/recalc-chunithm-scores.ts b/server/scripts/single-use/recalc-chunithm-scores.ts index 84592f80d..db1302755 100644 --- a/server/scripts/single-use/recalc-chunithm-scores.ts +++ b/server/scripts/single-use/recalc-chunithm-scores.ts @@ -9,7 +9,7 @@ const logger = CreateLogCtx(__filename); if (require.main === module) { let i = 0; db.scores - .find({ game: "chunithm", "scoreData.grade": "SS" }) + .find({ game: "chunithm", "scoreData.grade": null }) // @ts-expect-error dumb .each(async (oldScore, { pause, resume }) => { pause();