mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-10 16:28:17 +03:00
fix: broken batch manual classhandler logic (#1314)
Co-authored-by: zkldi <20380519+zkldi@users.noreply.github.com>
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
"@typescript-eslint/no-unsafe-argument": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
// we abuse this one for faking data, but we really shouldn't.
|
||||
"@typescript-eslint/consistent-type-assertions": "warn"
|
||||
"@typescript-eslint/consistent-type-assertions": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -6,9 +6,14 @@ import type { Classes, GPTString } from "tachi-common";
|
||||
|
||||
// Note: This is tested by batch-manuals parser.test.ts.
|
||||
export function CreateBatchManualClassProvider(
|
||||
outerGptString: GPTString,
|
||||
classes: Partial<Record<Classes[GPTString], string | null>>
|
||||
): ClassProvider {
|
||||
return (gptString, userID, ratings, logger) => {
|
||||
if (outerGptString !== gptString) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const gptConfig = GetGPTConfig(gptString);
|
||||
|
||||
const newObj: Partial<Record<Classes[GPTString], string>> = {};
|
||||
|
||||
@@ -2,7 +2,6 @@ import { ParseBatchManualFromObject as ParserFn } from "./parser";
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import deepmerge from "deepmerge";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { IIDX_DANS } from "tachi-common";
|
||||
import t from "tap";
|
||||
import { EscapeStringRegexp } from "utils/misc";
|
||||
import type { BatchManual } from "tachi-common";
|
||||
@@ -350,6 +349,7 @@ t.test("#ParserFn", (t) => {
|
||||
t.not(res.classProvider, null);
|
||||
|
||||
t.strictSame(res.classProvider!("iidx:SP", 1, {}, logger), { dan: "KAIDEN" });
|
||||
t.strictSame(res.classProvider!("iidx:DP", 1, {}, logger), {});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CreateBatchManualClassProvider } from "./class-handler";
|
||||
import ScoreImportFatalError from "../../../framework/score-importing/score-import-error";
|
||||
import { TachiConfig } from "lib/setup/config";
|
||||
import { p } from "prudence";
|
||||
import { GetGameConfig } from "tachi-common";
|
||||
import { GetGameConfig, GetGPTString } from "tachi-common";
|
||||
import { PR_BATCH_MANUAL } from "tachi-common/lib/schemas";
|
||||
import { IsRecord, IsValidGame, IsValidPlaytype } from "utils/misc";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
@@ -126,7 +126,7 @@ export function ParseBatchManualFromObject(
|
||||
// if classes are provided, use those as a class handler. Otherwise, we
|
||||
// don't care.
|
||||
classProvider: batchManual.classes
|
||||
? CreateBatchManualClassProvider(batchManual.classes)
|
||||
? CreateBatchManualClassProvider(GetGPTString(game, playtype), batchManual.classes)
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user