Allow custom and chart_sha256 to be undefined.

This commit is contained in:
zkldi
2021-11-18 19:10:11 +00:00
parent 1212476f9c
commit 0cdf9f7acc
3 changed files with 7 additions and 4 deletions
@@ -136,6 +136,9 @@ export const ConverterIRFervidex: ConverterFunction<FervidexScore, FervidexConte
let chart;
if (data.custom) {
if (!data.chart_sha256) {
throw new InvalidScoreFailure("Score has no chart_sha256 but is a custom?");
}
chart = await FindIIDXChartWith2DXtraHash(data.chart_sha256);
} else {
chart = await FindIIDXChartOnInGameIDVersion(
@@ -17,8 +17,8 @@ import { FervidexContext, FervidexScore } from "./types";
const PR_Fervidex: PrudenceSchema = {
chart: p.isIn("spb", "spn", "dpn", "sph", "dph", "spa", "dpa", "spl", "dpl"),
entry_id: p.isPositiveInteger,
chart_sha256: "string",
custom: "boolean",
chart_sha256: "*string",
custom: "*boolean",
pgreat: p.isPositiveInteger,
great: p.isPositiveInteger,
@@ -4,9 +4,9 @@ export interface FervidexScore {
chart: `${"sp" | "dp"}${"b" | "n" | "h" | "a" | "l"}`;
entry_id: integer;
chart_sha256: string;
chart_sha256?: string;
// whether or whether not this chart is from 2dxtra
custom: boolean;
custom?: boolean;
pgreat: integer;
great: integer;