This commit is contained in:
zkldi
2021-05-10 04:45:46 +01:00
parent 534910b9c6
commit d053be6fcb
4 changed files with 12 additions and 26 deletions
+5 -2
View File
@@ -4,9 +4,12 @@ js
logs
src/secrets.ts
src/scripts/validate-database-errs/*
.nyc_output
coverage
.env
.setup_env
.setup_env
scripts/arc-db-sync/charts.json
scripts/arc-db-sync/songs.json
scripts/validate-database-errs/*
+3 -3
View File
@@ -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:
@@ -9,6 +9,7 @@ const logger = CreateLogCtx("charts-iidx.ts");
async function ConvertFn(c: any): Promise<ChartDocument<"iidx:SP" | "iidx:DP">> {
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<ChartDocument<"iidx:SP" | "iidx:DP">>
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<ChartDocument<"iidx:SP" | "iidx:DP">>
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<ChartDocument<"iidx:SP" | "iidx:DP">>
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;
}
@@ -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.
*