From d053be6fcb577875a6a62a87cbf60f41939d5324 Mon Sep 17 00:00:00 2001 From: zkldi Date: Mon, 10 May 2021 04:45:46 +0100 Subject: [PATCH] ARC --- server/.gitignore | 7 +++++-- server/pnpm-lock.yaml | 6 +++--- .../__KT_DATABASE_MIGRATION/charts-iidx.ts | 21 ++----------------- .../framework/user-game-stats/classes.ts | 4 ++-- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/server/.gitignore b/server/.gitignore index c9ebd84df..780c3b553 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -4,9 +4,12 @@ js logs src/secrets.ts -src/scripts/validate-database-errs/* .nyc_output coverage .env -.setup_env \ No newline at end of file +.setup_env + +scripts/arc-db-sync/charts.json +scripts/arc-db-sync/songs.json +scripts/validate-database-errs/* diff --git a/server/pnpm-lock.yaml b/server/pnpm-lock.yaml index ce2e0167c..7ac4aee3c 100644 --- a/server/pnpm-lock.yaml +++ b/server/pnpm-lock.yaml @@ -62,7 +62,7 @@ dependencies: express-async-errors: 3.1.1_express@4.17.1 express-session: 1.17.1 fast-json-stable-hash: 1.0.2 - kamaitachi-common: github.com/zkldi/Kamaitachi-common/305f707b427867e9e00f5b122e61231b1d1493de + kamaitachi-common: github.com/zkldi/Kamaitachi-common/62b1afda73a0312ec30c59ca19a09abef428e6fe mongodb: 3.6.6 monk: 7.3.4 multer: 1.4.2 @@ -4638,8 +4638,8 @@ packages: '@types/yoga-layout': 1.9.2 dev: true - github.com/zkldi/Kamaitachi-common/305f707b427867e9e00f5b122e61231b1d1493de: - resolution: {tarball: https://codeload.github.com/zkldi/Kamaitachi-common/tar.gz/305f707b427867e9e00f5b122e61231b1d1493de} + github.com/zkldi/Kamaitachi-common/62b1afda73a0312ec30c59ca19a09abef428e6fe: + resolution: {tarball: https://codeload.github.com/zkldi/Kamaitachi-common/tar.gz/62b1afda73a0312ec30c59ca19a09abef428e6fe} name: kamaitachi-common version: 0.1.0 dependencies: diff --git a/server/scripts/__KT_DATABASE_MIGRATION/charts-iidx.ts b/server/scripts/__KT_DATABASE_MIGRATION/charts-iidx.ts index 74d2293ca..54e631c8b 100644 --- a/server/scripts/__KT_DATABASE_MIGRATION/charts-iidx.ts +++ b/server/scripts/__KT_DATABASE_MIGRATION/charts-iidx.ts @@ -9,6 +9,7 @@ const logger = CreateLogCtx("charts-iidx.ts"); async function ConvertFn(c: any): Promise> { let song = await db.songs.iidx.findOne({ id: c.id, + }); if (!song) { logger.severe(`Cannot find song with ID ${c.id}?`); @@ -23,8 +24,6 @@ async function ConvertFn(c: any): Promise> playtype: c.playtype, levelNum: c.levelNum, level: c.level.toString(), - length: c.length, - bpmString: "", // sentinel flags: { "IN BASE GAME": !!c.flags["IN BASE GAME"], OMNIMIX: !!c.flags.OMNIMIX, @@ -33,18 +32,12 @@ async function ConvertFn(c: any): Promise> data: { inGameID: c.internals.inGameINTID, notecount: c.notedata.notecount, + arcChartID: null, }, isPrimary: true, versions: [], // sentinel }; - if (typeof c.length === "number") { - let m = Math.floor(c.length / 60_000); - let s = ((c.length - m * 60_000) / 1_000).toFixed(2); - - newChartDoc.length = `${m}:${s}`; - } - let idx = gameOrders.iidx.indexOf(song.firstVersion!); if (idx === -1) { @@ -54,16 +47,6 @@ async function ConvertFn(c: any): Promise> newChartDoc.versions = gameOrders.iidx.slice(idx); } - if (c.monoBPM) { - newChartDoc.bpmString = c.bpmMin.toString(); - } else { - newChartDoc.bpmString = `${c.bpmMin}-${c.bpmMax}`; - } - - if (newChartDoc.length === null) { - logger.warn(`Length of chart ${newChartDoc.chartID} is null, continuing anyway?`); - } - return newChartDoc; } diff --git a/server/src/score-import/framework/user-game-stats/classes.ts b/server/src/score-import/framework/user-game-stats/classes.ts index 1e76e03b4..129808b85 100644 --- a/server/src/score-import/framework/user-game-stats/classes.ts +++ b/server/src/score-import/framework/user-game-stats/classes.ts @@ -53,8 +53,8 @@ const DEFAULT_CLASS_HANDLERS: ClassHandlerMap = { * * As an example, we are always able to calculate things like Gitadora's colours. We know the users' skill statistic, * and a colour is just between X-Y skill. However, we cannot always calculate something like IIDX's dans. Infact, - * there's no calculation involved. We need to instead request this information from a service. For things like arcana - * they exposes this on a dedicated endpoint. + * there's no calculation involved. We need to instead request this information from a service. For things like ARC + * they expose this on a dedicated endpoint. * The custom function allows us to request that data from a custom endpoint, and merge it with things we can always * calculate. *