mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-08 22:59:52 +03:00
Patch buggy stuff in sv6c
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import db from "external/mongo/db";
|
||||
import { KtLogger, rootLogger } from "lib/logger/logger";
|
||||
import { KtLogger } from "lib/logger/logger";
|
||||
import { ScoreImportJob } from "lib/score-import/worker/types";
|
||||
import {
|
||||
Game,
|
||||
GetGameConfig,
|
||||
IDStrings,
|
||||
ImportDocument,
|
||||
ImportProcessingInfo,
|
||||
@@ -10,9 +11,8 @@ import {
|
||||
integer,
|
||||
Playtypes,
|
||||
PublicUserDocument,
|
||||
GetGameConfig,
|
||||
} from "tachi-common";
|
||||
import { GetMillisecondsSince, Sleep } from "utils/misc";
|
||||
import { GetMillisecondsSince } from "utils/misc";
|
||||
import { GetUserWithID } from "utils/user";
|
||||
import { ConverterFunction, ImportInputParser } from "../../import-types/common/types";
|
||||
import { Converters } from "../../import-types/converters";
|
||||
@@ -28,6 +28,7 @@ import { ClassHandler } from "../user-game-stats/types";
|
||||
import { UpdateUsersGamePlaytypeStats } from "../user-game-stats/update-ugs";
|
||||
import ScoreImportFatalError from "./score-import-error";
|
||||
import { ImportAllIterableData } from "./score-importing";
|
||||
|
||||
/**
|
||||
* Performs a Score Import.
|
||||
*
|
||||
|
||||
@@ -48,18 +48,10 @@ t.test("#ParseKsHookSV6C", (t) => {
|
||||
assertFail(dm({ max_chain: -1 }), "Should reject negative max_chains.");
|
||||
assertFail(dm({ max_chain: 100.5 }), "Should reject non-integer max_chains.");
|
||||
|
||||
assertFail(dm({ btn_rate: -1 }), "Should reject negative btn_rates.");
|
||||
assertFail(dm({ btn_rate: 200.1 }), "Should reject btn_rates over 200.");
|
||||
assertSuccess(dm({ btn_rate: 0 }), "Should allow btn_rate values of 0.");
|
||||
assertSuccess(dm({ btn_rate: 200 }), "Should allow btn_rate values of 200.");
|
||||
assertFail(dm({ vol_rate: -1 }), "Should reject negative vol_rates.");
|
||||
assertFail(dm({ vol_rate: 200.1 }), "Should reject vol_rates over 200.");
|
||||
assertSuccess(dm({ vol_rate: 0 }), "Should allow vol_rate values of 0.");
|
||||
assertSuccess(dm({ vol_rate: 200 }), "Should allow vol_rate values of 200.");
|
||||
assertFail(dm({ long_rate: -1 }), "Should reject negative long_rates.");
|
||||
assertFail(dm({ long_rate: 200.1 }), "Should reject long_rates over 200.");
|
||||
assertSuccess(dm({ long_rate: 0 }), "Should allow long_rate values of 0.");
|
||||
assertSuccess(dm({ long_rate: 200 }), "Should allow long_rate values of 200.");
|
||||
assertFail(dm({ score: -1 }), "Should reject negative scores.");
|
||||
assertFail(dm({ score: 10_000_001 }), "Should reject > 10m scores.");
|
||||
assertSuccess(dm({ score: 10_000_000 }), "Should allow scores of 10m.");
|
||||
assertSuccess(dm({ score: 0 }), "Should allow scores of 0.");
|
||||
|
||||
assertFail(dm({ rate: "invalid_rate" }), "Should reject invalid rates.");
|
||||
|
||||
|
||||
@@ -36,15 +36,17 @@ const PR_KsHookSV6C: PrudenceSchema = {
|
||||
max_chain: p.isPositiveInteger,
|
||||
music_id: p.isPositiveInteger,
|
||||
|
||||
btn_rate: p.isBetween(0, 200),
|
||||
long_rate: p.isBetween(0, 200),
|
||||
vol_rate: p.isBetween(0, 200),
|
||||
|
||||
score: p.isBoundedInteger(0, 10_000_000),
|
||||
ex_score: p.isPositiveInteger,
|
||||
|
||||
critical: p.isPositiveInteger,
|
||||
near: p.isPositiveInteger,
|
||||
error: p.isPositiveInteger,
|
||||
|
||||
rate: p.isIn("RATE_EFFECTIVE", "RATE_PERMISSIVE", "RATE_EXCESSIVE", "RATE_BLASTIVE"),
|
||||
|
||||
track_no: p.isPositiveInteger,
|
||||
retry_count: p.any,
|
||||
};
|
||||
|
||||
export function ParseKsHookSV6C(
|
||||
|
||||
@@ -23,10 +23,6 @@ export interface KsHookSV6CScore {
|
||||
max_chain: integer;
|
||||
music_id: integer;
|
||||
|
||||
btn_rate: integer;
|
||||
long_rate: integer;
|
||||
vol_rate: integer;
|
||||
|
||||
critical: integer;
|
||||
near: integer;
|
||||
error: integer;
|
||||
@@ -36,6 +32,7 @@ export interface KsHookSV6CScore {
|
||||
ex_score: integer;
|
||||
|
||||
track_no: integer;
|
||||
retry_count: unknown;
|
||||
}
|
||||
|
||||
export interface KsHookSV6CContext {
|
||||
|
||||
@@ -371,7 +371,7 @@ t.test("GET /api/v1/users/:userID/game-stats", (t) => {
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("GET /api/v1/users/:userID/recent-imports", async (t) => {
|
||||
t.test("GET /api/v1/users/:userID/recent-imports", (t) => {
|
||||
t.beforeEach(ResetDBState);
|
||||
|
||||
function mkImport(
|
||||
|
||||
@@ -124,22 +124,20 @@ export const TestingIIDXSPScore: ScoreDocument<"iidx:SP"> = {
|
||||
};
|
||||
|
||||
export const TestingKsHookSV6CScore: KsHookSV6CScore = {
|
||||
btn_rate: 182,
|
||||
clear: "CLEAR_EXCESSIVE",
|
||||
critical: 1184,
|
||||
difficulty: "DIFFICULTY_ADVANCED",
|
||||
error: 30,
|
||||
gauge: 71,
|
||||
grade: "GRADE_AA_PLUS",
|
||||
long_rate: 195,
|
||||
max_chain: 158,
|
||||
music_id: 1,
|
||||
near: 46,
|
||||
rate: "RATE_EXCESSIVE",
|
||||
score: 9579365,
|
||||
track_no: 0,
|
||||
vol_rate: 193,
|
||||
ex_score: 1334,
|
||||
retry_count: 0,
|
||||
};
|
||||
export const TestingBMS7KScore: ScoreDocument<"bms:7K"> = {
|
||||
calculatedData: {
|
||||
|
||||
Reference in New Issue
Block a user