mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-11 08:48:15 +03:00
Fix pop'n grades and add pop'n to genericcalcpercent
This commit is contained in:
@@ -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 }),
|
||||
|
||||
@@ -38,7 +38,14 @@ export const ConverterBatchManual: ConverterFunction<BatchManualScore, BatchManu
|
||||
|
||||
const { song, chart } = await ResolveMatchTypeToKTData(data, context, importType, logger);
|
||||
|
||||
const { percent, grade } = GenericGetGradeAndPercent(context.game, data.score, chart);
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { percent, grade } = GenericGetGradeAndPercent(context.game, data.score, chart);
|
||||
|
||||
// Temporary hack -- Pop'n upper bounds grades like this. We need to tuck this
|
||||
// away further inside genericgetgradeandpercent or something.
|
||||
if (game === "popn" && data.lamp === "FAILED" && percent >= 90) {
|
||||
grade = "A";
|
||||
}
|
||||
|
||||
let service = context.service;
|
||||
|
||||
@@ -62,7 +69,7 @@ export const ConverterBatchManual: ConverterFunction<BatchManualScore, BatchManu
|
||||
judgements: data.judgements ?? {},
|
||||
hitMeta: data.hitMeta ?? {},
|
||||
},
|
||||
scoreMeta: {}, // @todo #74
|
||||
scoreMeta: data.scoreMeta ?? {},
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user