mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-06 22:07:58 +03:00
Move a lot of stuff
This commit is contained in:
@@ -8,7 +8,7 @@ import { GetUserWithID } from "../../core/user-core";
|
||||
import CreateLogCtx from "../../logger";
|
||||
import prValidate from "../../middleware/prudence-validate";
|
||||
import { RequireLoggedIn } from "../../middleware/require-logged-in";
|
||||
import ScoreImportFatalError from "../../score-import/framework/core/score-import-error";
|
||||
import ScoreImportFatalError from "../../score-import/framework/common/score-import-error";
|
||||
import ScoreImportMain from "../../score-import/framework/score-import-main";
|
||||
import ParseEamusementCSV from "../../score-import/import-types/file/csv-eamusement-iidx/parser";
|
||||
|
||||
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
import Pr from "prudence";
|
||||
import t from "tap";
|
||||
import { CloseMongoConnection } from "../../../../db/db";
|
||||
import CreateLogCtx from "../../../../logger";
|
||||
import { prAssert } from "../../../../test-utils/asserts";
|
||||
import { CloseMongoConnection } from "../../../db/db";
|
||||
import CreateLogCtx from "../../../logger";
|
||||
import { prAssert } from "../../../test-utils/asserts";
|
||||
import {
|
||||
Testing511SPA,
|
||||
TestingDoraChart,
|
||||
TestingGITADORADoraDryScore,
|
||||
TestingIIDXSPDryScore,
|
||||
} from "../../../../test-utils/test-data";
|
||||
} from "../../../test-utils/test-data";
|
||||
import { CreateCalculatedData } from "./calculated-data";
|
||||
|
||||
const mockLogger = CreateLogCtx("calculated-data.test.ts");
|
||||
+1
-1
@@ -8,7 +8,7 @@ import {
|
||||
TierlistDataDocument,
|
||||
} from "kamaitachi-common";
|
||||
import { Logger } from "winston";
|
||||
import { DryScore } from "../../../../types";
|
||||
import { DryScore } from "../../../types";
|
||||
import { CreateGameSpecific } from "./game-specific";
|
||||
import { CalculateCHUNITHMRating, CalculateGITADORARating } from "./game-specific-stats";
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
import t from "tap";
|
||||
import { CloseMongoConnection } from "../../../../db/db";
|
||||
import { DryScore } from "../../../../types";
|
||||
import { CloseMongoConnection } from "../../../db/db";
|
||||
import { DryScore } from "../../../types";
|
||||
import { AnyChartDocument, Difficulties, Lamps, ScoreDocument } from "kamaitachi-common";
|
||||
import {
|
||||
CalculateBPI,
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
CalculateVF5,
|
||||
KaidenPercentile,
|
||||
} from "./game-specific-stats";
|
||||
import CreateLogCtx from "../../../../logger";
|
||||
import { isApproximately } from "../../../../test-utils/asserts";
|
||||
import CreateLogCtx from "../../../logger";
|
||||
import { isApproximately } from "../../../test-utils/asserts";
|
||||
|
||||
t.test("#CalculateBPI", (t) => {
|
||||
t.test("AA BPI tests", (t) => {
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { AnyChartDocument, ChartDocument, ESDCore, integer } from "kamaitachi-common";
|
||||
import { Logger } from "winston";
|
||||
import db from "../../../../db/db";
|
||||
import { DryScore } from "../../../../types";
|
||||
import db from "../../../db/db";
|
||||
import { DryScore } from "../../../types";
|
||||
|
||||
/**
|
||||
* Calculates the in-game CHUNITHM rating for a score.
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
import Pr from "prudence";
|
||||
import t from "tap";
|
||||
import { CloseMongoConnection } from "../../../../db/db";
|
||||
import CreateLogCtx from "../../../../logger";
|
||||
import { prAssert } from "../../../../test-utils/asserts";
|
||||
import { CloseMongoConnection } from "../../../db/db";
|
||||
import CreateLogCtx from "../../../logger";
|
||||
import { prAssert } from "../../../test-utils/asserts";
|
||||
import {
|
||||
Testing511SPA,
|
||||
TestingIIDXSPDryScore,
|
||||
TestingSDVXSingleDryScore,
|
||||
} from "../../../../test-utils/test-data";
|
||||
} from "../../../test-utils/test-data";
|
||||
import { CreateGameSpecific } from "./game-specific";
|
||||
const logger = CreateLogCtx("fake-testing-context");
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { AnyChartDocument, ChartDocument, Game, Playtypes } from "kamaitachi-common";
|
||||
import { Logger } from "winston";
|
||||
import db from "../../../../db/db";
|
||||
import { DryScore } from "../../../../types";
|
||||
import db from "../../../db/db";
|
||||
import { DryScore } from "../../../types";
|
||||
import {
|
||||
CalculateBPI,
|
||||
CalculateKESDC,
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import t from "tap";
|
||||
import { InvalidScoreFailure } from "./converter-failures";
|
||||
import { InvalidScoreFailure } from "../importing/converter-failures";
|
||||
import { AssertStrAsPositiveInt, AssertStrAsPositiveNonZeroInt } from "./string-asserts";
|
||||
|
||||
function astr(v: string) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { InvalidScoreFailure } from "./converter-failures";
|
||||
import { InvalidScoreFailure } from "../importing/converter-failures";
|
||||
|
||||
const isIntegerRegex = /^-?\d+$/;
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import {
|
||||
} from "kamaitachi-common";
|
||||
import { Logger } from "winston";
|
||||
import { DryScore } from "../../../types";
|
||||
import { CreateCalculatedData } from "./calculated-data/calculated-data";
|
||||
import { CreateCalculatedData } from "../calculated-data/calculated-data";
|
||||
|
||||
/**
|
||||
* Takes an "intermediate" score and appends the rest of the data it needs.
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { ScoreDocument } from "kamaitachi-common";
|
||||
import t from "tap";
|
||||
import db, { CloseMongoConnection } from "../../../db/db";
|
||||
import ResetDBState from "../../../test-utils/reset-db-state";
|
||||
import { InsertQueue, QueueScoreInsert } from "./insert-score";
|
||||
import { InsertQueue, QueueScoreInsert } from "../common/insert-score";
|
||||
|
||||
// these two get the same tests, because they're too closely linked
|
||||
t.test("#QueueScoreInsert, #InsertQueue", async (t) => {
|
||||
@@ -6,15 +6,15 @@ import {
|
||||
AnySongDocument,
|
||||
} from "kamaitachi-common";
|
||||
import { DryScore, ConverterFunction, ConverterFnReturn, KtLogger } from "../../../types";
|
||||
import HydrateScore from "../core/hydrate-score";
|
||||
import { QueueScoreInsert, ScoreIDs } from "../core/insert-score";
|
||||
import HydrateScore from "./hydrate-score";
|
||||
import { QueueScoreInsert, ScoreIDs } from "../common/insert-score";
|
||||
import {
|
||||
ConverterFailure,
|
||||
InternalFailure,
|
||||
InvalidScoreFailure,
|
||||
KTDataNotFoundFailure,
|
||||
} from "../core/converter-failures";
|
||||
import { CreateScoreID } from "../core/score-id";
|
||||
} from "./converter-failures";
|
||||
import { CreateScoreID } from "../common/score-id";
|
||||
import db from "../../../db/db";
|
||||
import { AppendLogCtx } from "../../../logger";
|
||||
|
||||
|
||||
+5
-5
@@ -1,16 +1,16 @@
|
||||
import t from "tap";
|
||||
import db, { CloseMongoConnection } from "../../../../db/db";
|
||||
import ResetDBState from "../../../../test-utils/reset-db-state";
|
||||
import db, { CloseMongoConnection } from "../../../db/db";
|
||||
import ResetDBState from "../../../test-utils/reset-db-state";
|
||||
import {
|
||||
GetKTDataJSON,
|
||||
Testing511SPA,
|
||||
TestingIIDXSPScore,
|
||||
TestingIIDXSPScorePB,
|
||||
} from "../../../../test-utils/test-data";
|
||||
} from "../../../test-utils/test-data";
|
||||
import { CreatePBDoc, GetRankingInfo } from "./create-pb-doc";
|
||||
import deepmerge from "deepmerge";
|
||||
import CreateLogCtx from "../../../../logger";
|
||||
import { KtLogger } from "../../../../types";
|
||||
import CreateLogCtx from "../../../logger";
|
||||
import { KtLogger } from "../../../types";
|
||||
import { lamps } from "kamaitachi-common/js/config";
|
||||
|
||||
let IIDXScore = TestingIIDXSPScore;
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import db from "../../../../db/db";
|
||||
import db from "../../../db/db";
|
||||
import { integer, ScoreDocument, PBScoreDocument } from "kamaitachi-common";
|
||||
|
||||
import { KtLogger } from "../../../../types";
|
||||
import { KtLogger } from "../../../types";
|
||||
import { IIDXMergeFn } from "./game-specific-merge";
|
||||
|
||||
export async function CreatePBDoc(userID: integer, chartID: string, logger: KtLogger) {
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { PBScoreDocument, ScoreDocument } from "kamaitachi-common";
|
||||
import db from "../../../../db/db";
|
||||
import { KtLogger } from "../../../../types";
|
||||
import db from "../../../db/db";
|
||||
import { KtLogger } from "../../../types";
|
||||
|
||||
export async function IIDXMergeFn(
|
||||
pbDoc: PBScoreDocument<"iidx:SP" | "iidx:DP">,
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
import t from "tap";
|
||||
import db, { CloseMongoConnection } from "../../../../db/db";
|
||||
import CreateLogCtx from "../../../../logger";
|
||||
import ResetDBState from "../../../../test-utils/reset-db-state";
|
||||
import { Testing511SPA, TestingIIDXSPScore } from "../../../../test-utils/test-data";
|
||||
import db, { CloseMongoConnection } from "../../../db/db";
|
||||
import CreateLogCtx from "../../../logger";
|
||||
import ResetDBState from "../../../test-utils/reset-db-state";
|
||||
import { Testing511SPA, TestingIIDXSPScore } from "../../../test-utils/test-data";
|
||||
import { ProcessPBs } from "./process-pbs";
|
||||
import deepmerge from "deepmerge";
|
||||
import crypto from "crypto";
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { integer, PBScoreDocument } from "kamaitachi-common";
|
||||
import db from "../../../../db/db";
|
||||
import { KtLogger } from "../../../../types";
|
||||
import db from "../../../db/db";
|
||||
import { KtLogger } from "../../../types";
|
||||
import { CreatePBDoc } from "./create-pb-doc";
|
||||
|
||||
export async function ProcessPBs(
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
PublicUserDocument,
|
||||
} from "kamaitachi-common";
|
||||
import { ImportInputParser, ScorePlaytypeMap } from "../../types";
|
||||
import { InsertQueue } from "./core/insert-score";
|
||||
import { InsertQueue } from "./common/insert-score";
|
||||
import { ImportAllIterableData } from "./importing/score-importing";
|
||||
import { CreateImportLoggerAndID } from "./core/import-logger";
|
||||
import { CreateSessions } from "./core/sessions/sessions";
|
||||
import { CreateImportLoggerAndID } from "./common/import-logger";
|
||||
import { CreateSessions } from "./sessions/sessions";
|
||||
import { GetMilisecondsSince } from "../../core/hrtime-core";
|
||||
import { ProcessPBs } from "./core/pb/process-pbs";
|
||||
import { ProcessPBs } from "./pb/process-pbs";
|
||||
|
||||
export default async function ScoreImportMain<D, C>(
|
||||
user: PublicUserDocument,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { GetRandomAdjective, GetRandomNoun } from "../../../../data/words";
|
||||
import { GetRandomAdjective, GetRandomNoun } from "../../../data/words";
|
||||
|
||||
export function GenerateRandomSessionName() {
|
||||
let adj1 = GetRandomAdjective();
|
||||
+4
-4
@@ -9,13 +9,13 @@ import {
|
||||
SessionInfoReturn,
|
||||
Game,
|
||||
} from "kamaitachi-common";
|
||||
import db from "../../../../db/db";
|
||||
import { AppendLogCtx } from "../../../../logger";
|
||||
import db from "../../../db/db";
|
||||
import { AppendLogCtx } from "../../../logger";
|
||||
import { GenerateRandomSessionName } from "./name-generation";
|
||||
import crypto from "crypto";
|
||||
import { CreateSessionCalcData } from "./performance-calc";
|
||||
import { GetScoresFromSession } from "../../../../core/session-core";
|
||||
import { KtLogger, ScorePlaytypeMap } from "../../../../types";
|
||||
import { GetScoresFromSession } from "../../../core/session-core";
|
||||
import { KtLogger, ScorePlaytypeMap } from "../../../types";
|
||||
|
||||
const TWO_HOURS = 1000 * 60 * 60 * 2;
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
ConverterFailure,
|
||||
InvalidScoreFailure,
|
||||
KTDataNotFoundFailure,
|
||||
} from "../../../framework/core/converter-failures";
|
||||
} from "../../../framework/importing/converter-failures";
|
||||
|
||||
const logger = CreateLogCtx("converter.test.ts");
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
KTDataNotFoundFailure,
|
||||
InternalFailure,
|
||||
InvalidScoreFailure,
|
||||
} from "../../../framework/core/converter-failures";
|
||||
import ScoreImportFatalError from "../../../framework/core/score-import-error";
|
||||
import { GetGradeFromPercent } from "../../../framework/core/score-utils";
|
||||
import { AssertStrAsPositiveInt } from "../../../framework/core/string-asserts";
|
||||
} from "../../../framework/importing/converter-failures";
|
||||
import ScoreImportFatalError from "../../../framework/common/score-import-error";
|
||||
import { GetGradeFromPercent } from "../../../framework/common/score-utils";
|
||||
import { AssertStrAsPositiveInt } from "../../../framework/common/string-asserts";
|
||||
import { EamusementScoreData, IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./types";
|
||||
|
||||
const EAMUSEMENT_LAMP_RESOLVER: Map<string, Lamps["iidx:SP" | "iidx:DP"]> = new Map([
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import t from "tap";
|
||||
import CreateLogCtx from "../../../../logger";
|
||||
import ScoreImportFatalError from "../../../framework/core/score-import-error";
|
||||
import ScoreImportFatalError from "../../../framework/common/score-import-error";
|
||||
import ParseEamusementCSV, { NaiveCSVParse, ResolveHeaders } from "./parser";
|
||||
import { CloseMongoConnection } from "../../../../db/db";
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Difficulties } from "kamaitachi-common";
|
||||
import { Logger } from "winston";
|
||||
import { ParserFunctionReturnsSync } from "../../../../types";
|
||||
import ScoreImportFatalError from "../../../framework/core/score-import-error";
|
||||
import ScoreImportFatalError from "../../../framework/common/score-import-error";
|
||||
import ConverterFn from "./converter";
|
||||
import { EamusementScoreData, IIDXEamusementCSVContext, IIDXEamusementCSVData } from "./types";
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import {
|
||||
Playtypes,
|
||||
} from "kamaitachi-common";
|
||||
import { Logger, LeveledLogMethod } from "winston";
|
||||
import { ConverterFailure } from "./score-import/framework/core/converter-failures";
|
||||
import { ConverterFailure } from "./score-import/framework/importing/converter-failures";
|
||||
import { Converters } from "./score-import/import-types/import-types";
|
||||
|
||||
declare module "express-session" {
|
||||
|
||||
Reference in New Issue
Block a user