mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-03 04:18:16 +03:00
Return null for unofficial usc charts.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
TestingSDVXSingleDryScore,
|
||||
} from "test-utils/test-data";
|
||||
import { CreateCalculatedData, CalculateDataForGamePT } from "./calculated-data";
|
||||
import { ChartDocument, ScoreDocument } from "tachi-common";
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
@@ -41,6 +42,15 @@ t.test("#CreateCalculatedData", async (t) => {
|
||||
"Should correctly call rating function overrides for different games"
|
||||
);
|
||||
|
||||
const uscRes = await CreateCalculatedData(
|
||||
{ game: "usc", playtype: "Single" } as ScoreDocument,
|
||||
{ data: { isOfficial: false }, playtype: "Single" } as ChartDocument,
|
||||
null,
|
||||
logger
|
||||
);
|
||||
|
||||
t.strictSame(uscRes, { VF6: null }, "Should return null if chart was not an official.");
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
@@ -199,6 +199,11 @@ function CalculateDataSDVXorUSC(
|
||||
defaultTierlistID: string | undefined,
|
||||
logger: KtLogger
|
||||
): CalculatedData<"sdvx:Single" | "usc:Single"> {
|
||||
// for usc, unofficial charts currently have no VF6 value.
|
||||
if (dryScore.game === "usc" && !(chart as ChartDocument<"usc:Single">).data.isOfficial) {
|
||||
return { VF6: null };
|
||||
}
|
||||
|
||||
const VF6 = CalculateVF6(
|
||||
dryScore.scoreData.grade as Grades["sdvx:Single"],
|
||||
dryScore.scoreData.lamp as Lamps["sdvx:Single"],
|
||||
|
||||
Reference in New Issue
Block a user