diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts index fda4b8179..1e3bfe039 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.test.ts @@ -465,6 +465,80 @@ t.test("#ConverterFn", (t) => { t.end(); }); + t.test("Should cap pop'n grades at A if they failed.", async (t) => { + const res = await ConverterBatchManual( + { + score: 99_000, + lamp: "FAILED", + difficulty: "Easy", + matchType: "tachiSongID", + identifier: "1", + }, + { game: "popn", service: "foo", playtype: "9B", version: null }, + importType, + logger + ); + + t.hasStrict(res, { + chart: { songID: 1, difficulty: "Easy" }, + song: { id: 1 }, + dryScore: { + game: "popn", + service: "foo (BATCH-MANUAL)", + comment: null, + importType: "file/batch-manual", + timeAchieved: null, + scoreData: { + lamp: "FAILED", + score: 99_000, + grade: "A", + judgements: {}, + hitMeta: {}, + }, + scoreMeta: {}, + }, + }); + + t.end(); + }); + + t.test("Should cap pop'n grades at A if they bordered AA.", async (t) => { + const res = await ConverterBatchManual( + { + score: 90_000, + lamp: "FAILED", + difficulty: "Easy", + matchType: "tachiSongID", + identifier: "1", + }, + { game: "popn", service: "foo", playtype: "9B", version: null }, + importType, + logger + ); + + t.hasStrict(res, { + chart: { songID: 1, difficulty: "Easy" }, + song: { id: 1 }, + dryScore: { + game: "popn", + service: "foo (BATCH-MANUAL)", + comment: null, + importType: "file/batch-manual", + timeAchieved: null, + scoreData: { + lamp: "FAILED", + score: 90_000, + grade: "A", + judgements: {}, + hitMeta: {}, + }, + scoreMeta: {}, + }, + }); + + t.end(); + }); + t.test("Should produce a with timeAchieved null if timeAchieved is 0", async (t) => { const res = await ConverterBatchManual( deepmerge(baseBatchManualScore, { timeAchieved: 0 }), diff --git a/server/src/lib/score-import/import-types/common/batch-manual/converter.ts b/server/src/lib/score-import/import-types/common/batch-manual/converter.ts index 7fc5e9563..adc439e08 100644 --- a/server/src/lib/score-import/import-types/common/batch-manual/converter.ts +++ b/server/src/lib/score-import/import-types/common/batch-manual/converter.ts @@ -38,7 +38,14 @@ export const ConverterBatchManual: ConverterFunction= 90) { + grade = "A"; + } let service = context.service; @@ -62,7 +69,7 @@ export const ConverterBatchManual: ConverterFunction