mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-13 09:48:27 +03:00
Merge branch 'develop' into zkldi/issue-45
This commit is contained in:
Vendored
+9
-7
@@ -63,13 +63,7 @@ const staticIndexes: Partial<Record<Databases, Index[]>> = {
|
||||
index({ title: "text", searchTerms: "text" }),
|
||||
],
|
||||
"kai-auth-tokens": [index({ userID: 1, service: 1 }, UNIQUE)],
|
||||
"charts-iidx": [
|
||||
index(
|
||||
{ "data.arcChartID": 1 },
|
||||
{ unique: true, partialFilterExpression: { "data.arcChartID": { $type: "string" } } }
|
||||
),
|
||||
index({ "data.hashSHA256": 1 }),
|
||||
],
|
||||
|
||||
"bms-course-lookup": [index({ md5sums: 1 }, UNIQUE)],
|
||||
"api-tokens": [index({ token: 1 }, UNIQUE), index({ userID: 1 })],
|
||||
tables: [index({ tableID: 1, game: 1, playtype: 1 }, UNIQUE)],
|
||||
@@ -84,6 +78,14 @@ const staticIndexes: Partial<Record<Databases, Index[]>> = {
|
||||
counters: [index({ counterName: 1 }, UNIQUE)],
|
||||
"class-achievements": [index({ game: 1, playtype: 1, timeAchieved: 1 })],
|
||||
"api-clients": [index({ clientID: 1 }, UNIQUE)],
|
||||
"charts-iidx": [
|
||||
index(
|
||||
{ "data.arcChartID": 1 },
|
||||
{ unique: true, partialFilterExpression: { "data.arcChartID": { $type: "string" } } }
|
||||
),
|
||||
index({ "data.hashSHA256": 1 }),
|
||||
index({ "data.inGameID": 1, playtype: 1, difficulty: 1 }),
|
||||
],
|
||||
"charts-bms": [index({ "data.hashMD5": 1 }, UNIQUE), index({ "data.hashSHA256": 1 }, UNIQUE)],
|
||||
"charts-popn": [index({ "data.hashSHA256": 1 }, UNIQUE)],
|
||||
"charts-sdvx": [index({ "data.inGameID": 1, difficulty: 1 }, UNIQUE)],
|
||||
|
||||
@@ -69,6 +69,7 @@ const SUPPORTED_BMS_CLIENTS = [
|
||||
"LR2oraja 0.8.2",
|
||||
"LR2oraja 0.8.1",
|
||||
"LR2oraja 0.8.0",
|
||||
"LR2oraja(rekidai.info) 0.8.4",
|
||||
"LR2oraja(rekidai.info) 0.8.3",
|
||||
"LR2oraja(rekidai.info) 0.8.2",
|
||||
"LR2oraja(rekidai.info) 0.8.1",
|
||||
|
||||
@@ -91,7 +91,7 @@ function ConvertRandom(
|
||||
random: LR2HookScore["playerData"]["random"]
|
||||
): ScoreDocument<"bms:7K">["scoreMeta"]["random"] {
|
||||
switch (random) {
|
||||
case "NONRAN":
|
||||
case "NORAN":
|
||||
return "NONRAN";
|
||||
case "MIRROR":
|
||||
return "MIRROR";
|
||||
|
||||
@@ -5,7 +5,7 @@ import p, { PrudenceSchema } from "prudence";
|
||||
import ScoreImportFatalError from "lib/score-import/framework/score-importing/score-import-error";
|
||||
import { FormatPrError } from "utils/prudence";
|
||||
|
||||
const SUPPORTED_RANDOMS = ["NONRAN", "MIRROR", "RAN", "S-RAN"];
|
||||
const SUPPORTED_RANDOMS = ["NORAN", "MIRROR", "RAN", "S-RAN"];
|
||||
|
||||
const PR_LR2Hook: PrudenceSchema = {
|
||||
md5: "string",
|
||||
|
||||
@@ -5,7 +5,7 @@ export interface LR2HookScore {
|
||||
playerData: {
|
||||
autoScr: 0;
|
||||
gameMode: unknown;
|
||||
random: "NONRAN" | "MIRROR" | "RAN" | "S-RAN";
|
||||
random: "NORAN" | "MIRROR" | "RAN" | "S-RAN";
|
||||
gauge: "GROOVE" | "HAZARD" | "HARD" | "EASY" | "P-ATTACK" | "G-ATTACK";
|
||||
};
|
||||
scoreData: {
|
||||
|
||||
@@ -64,8 +64,12 @@ t.test("#UpdateScore", (t) => {
|
||||
scoreData: { score: 1020 },
|
||||
} as any);
|
||||
|
||||
delete score._id;
|
||||
|
||||
const newScoreID = CreateScoreID(score.userID, score, score.chartID);
|
||||
|
||||
rootLogger.crit(newScoreID);
|
||||
|
||||
await db.imports.insert(mockImportDocument);
|
||||
await db.sessions.insert(mockSessionDocument);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { KtLogger, rootLogger } from "lib/logger/logger";
|
||||
import { CreateCalculatedData } from "lib/score-import/framework/calculated-data/calculated-data";
|
||||
import { UpdateChartRanking } from "lib/score-import/framework/pb/create-pb-doc";
|
||||
import { CreateScoreID } from "lib/score-import/framework/score-importing/score-id";
|
||||
import { id } from "monk";
|
||||
import { ScoreDocument } from "tachi-common";
|
||||
import { UpdateAllPBs } from "utils/calculations/recalc-scores";
|
||||
import { FormatUserDoc, GetUserWithID } from "utils/user";
|
||||
@@ -67,6 +68,8 @@ export default async function UpdateScore(oldScore: ScoreDocument, newScore: Sco
|
||||
);
|
||||
|
||||
try {
|
||||
// Having _id defined will cause this to throw, causing it to not apply
|
||||
// the update.
|
||||
if (newScore._id) {
|
||||
logger.warn(
|
||||
`Passed a score with _id to UpdateScore. This property should not be set. Deleting this property and continuing anyway.`
|
||||
|
||||
Reference in New Issue
Block a user