fix: don't reject entire imports if player has battle scores

This commit is contained in:
zkldi
2024-10-04 17:11:26 +01:00
parent a0830a91a8
commit 3f24fc83fd
2 changed files with 9 additions and 1 deletions
@@ -77,7 +77,11 @@ const PR_CG_POPN = {
difficulty: p.isPositiveInteger,
version: p.isPositiveInteger,
clearFlag: p.isPositiveInteger,
score: p.isBoundedInteger(0, 100_000),
// edge case. Score can go above 100k in battle mode.
// although we don't support battle mode,
// we cannot reject this in the parser - as it will cancel the entire import.
score: p.isPositiveInteger,
coolCount: p.isPositiveInteger,
greatCount: p.isPositiveInteger,
@@ -23,6 +23,10 @@ export const ConverterAPICGPopn: ConverterFunction<CGPopnScore, CGContext> = asy
const difficulty = ConvertDifficulty(data.difficulty);
const version = ConvertVersion(data.version);
if (data.score > 100_000) {
throw new InvalidScoreFailure(`Score is > 100_000 (got ${data.score})`);
}
const chart = await FindChartOnInGameIDVersion(
"popn",
data.internalId,