From abf38477fc23929ac2cfa177ce999977e7545498 Mon Sep 17 00:00:00 2001 From: zkldi Date: Fri, 30 Apr 2021 02:10:08 +0100 Subject: [PATCH] More file movement --- .../framework/{importing => common}/score-utils.ts | 2 ++ server/src/score-import/framework/importing/hydrate-score.ts | 2 +- .../import-types/file/csv-eamusement-iidx/converter.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) rename server/src/score-import/framework/{importing => common}/score-utils.ts (88%) diff --git a/server/src/score-import/framework/importing/score-utils.ts b/server/src/score-import/framework/common/score-utils.ts similarity index 88% rename from server/src/score-import/framework/importing/score-utils.ts rename to server/src/score-import/framework/common/score-utils.ts index 5cd3d2c53..94cff34d8 100644 --- a/server/src/score-import/framework/importing/score-utils.ts +++ b/server/src/score-import/framework/common/score-utils.ts @@ -1,4 +1,5 @@ import { config, Game, Grades, IDStrings } from "kamaitachi-common"; +import { logger } from "../../../logger"; /** * Util for getting a games' grade for a given percent. @@ -18,5 +19,6 @@ export function GetGradeFromPercent( } } + // failsafe return null; } diff --git a/server/src/score-import/framework/importing/hydrate-score.ts b/server/src/score-import/framework/importing/hydrate-score.ts index a82a4c1a0..660a17768 100644 --- a/server/src/score-import/framework/importing/hydrate-score.ts +++ b/server/src/score-import/framework/importing/hydrate-score.ts @@ -31,7 +31,7 @@ export default async function HydrateScore( { // @todo lamps may need to be separate upon game:playtype someday. Maybe. We need to check this out lampIndex: config.lamps[dryScore.game].indexOf(dryScore.scoreData.lamp as string), - gradeIndex: config.grades[dryScore.game].indexOf(dryScore.scoreData.lamp as string), + gradeIndex: config.grades[dryScore.game].indexOf(dryScore.scoreData.grade as string), }, dryScoreData ); diff --git a/server/src/score-import/import-types/file/csv-eamusement-iidx/converter.ts b/server/src/score-import/import-types/file/csv-eamusement-iidx/converter.ts index bbea9f760..f1e0cf694 100644 --- a/server/src/score-import/import-types/file/csv-eamusement-iidx/converter.ts +++ b/server/src/score-import/import-types/file/csv-eamusement-iidx/converter.ts @@ -9,7 +9,7 @@ import { InvalidScoreFailure, } from "../../../framework/importing/converter-failures"; import ScoreImportFatalError from "../../../framework/importing/score-import-error"; -import { GetGradeFromPercent } from "../../../framework/importing/score-utils"; +import { GetGradeFromPercent } from "../../../framework/common/score-utils"; import { AssertStrAsPositiveInt } from "../../../framework/common/string-asserts"; import { EamusementScoreData, IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./types"; @@ -107,6 +107,7 @@ export async function EamScoreConverter( const grade = GetGradeFromPercent<"iidx:SP" | "iidx:DP">("iidx", percent); if (!grade) { + logger.warn(`${HUMANISED_CHART_TITLE} - Could not resolve ${percent} into a grade?`); throw new InternalFailure( `${HUMANISED_CHART_TITLE} - Could not resolve ${percent} into a grade?` );