mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-09 15:19:50 +03:00
replace all instances of hitData with judgements
This commit is contained in:
@@ -12,133 +12,133 @@ const logger = CreateLogCtx(__filename);
|
||||
// HERE. WE. GO!
|
||||
|
||||
function ConditionalAssign(base: any, baseProp: string, other: any, otherProp: string) {
|
||||
if (Object.prototype.hasOwnProperty.call(other, otherProp)) {
|
||||
base[baseProp] = other[otherProp];
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(other, otherProp)) {
|
||||
base[baseProp] = other[otherProp];
|
||||
}
|
||||
}
|
||||
|
||||
function ConvertFn(c: any): ScoreDocument | null {
|
||||
if (!supportedGames.includes(c.game)) {
|
||||
logger.warn(`Ignored game ${c.game}`);
|
||||
return null;
|
||||
}
|
||||
if (!supportedGames.includes(c.game)) {
|
||||
logger.warn(`Ignored game ${c.game}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (["popn", "jubeat", "gitadora", "usc"].includes(c.game)) {
|
||||
return null;
|
||||
}
|
||||
if (["popn", "jubeat", "gitadora", "usc"].includes(c.game)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (validPlaytypes[c.game].includes(c.playtype)) {
|
||||
logger.warn(`Ignored game pt ${c.game}, ${c.playtype}`);
|
||||
}
|
||||
if (validPlaytypes[c.game].includes(c.playtype)) {
|
||||
logger.warn(`Ignored game pt ${c.game}, ${c.playtype}`);
|
||||
}
|
||||
|
||||
const base: Omit<ScoreDocument, "scoreID"> = {
|
||||
userID: c.userID,
|
||||
songID: c.songID,
|
||||
playtype: c.scoreData.playtype,
|
||||
chartID: c.chartID,
|
||||
game: c.game,
|
||||
timeAdded: c.timeAdded,
|
||||
timeAchieved: Number.isNaN(c.timeAchieved) ? null : c.timeAchieved,
|
||||
comment: c.comment ?? null,
|
||||
highlight: c.highlight ?? false,
|
||||
service: c.service,
|
||||
importType: null,
|
||||
calculatedData: c.calculatedData,
|
||||
scoreData: {
|
||||
esd: c.scoreData.esd ?? null,
|
||||
grade: c.scoreData.grade,
|
||||
gradeIndex: grades[c.game].indexOf(c.scoreData.grade),
|
||||
lamp: c.scoreData.lamp,
|
||||
lampIndex: lamps[c.game].indexOf(c.scoreData.lamp),
|
||||
percent: c.scoreData.percent,
|
||||
score: c.scoreData.score,
|
||||
hitData: c.scoreData.hitData,
|
||||
hitMeta: c.scoreData.hitMeta,
|
||||
},
|
||||
scoreMeta: {},
|
||||
};
|
||||
const base: Omit<ScoreDocument, "scoreID"> = {
|
||||
userID: c.userID,
|
||||
songID: c.songID,
|
||||
playtype: c.scoreData.playtype,
|
||||
chartID: c.chartID,
|
||||
game: c.game,
|
||||
timeAdded: c.timeAdded,
|
||||
timeAchieved: Number.isNaN(c.timeAchieved) ? null : c.timeAchieved,
|
||||
comment: c.comment ?? null,
|
||||
highlight: c.highlight ?? false,
|
||||
service: c.service,
|
||||
importType: null,
|
||||
calculatedData: c.calculatedData,
|
||||
scoreData: {
|
||||
esd: c.scoreData.esd ?? null,
|
||||
grade: c.scoreData.grade,
|
||||
gradeIndex: grades[c.game].indexOf(c.scoreData.grade),
|
||||
lamp: c.scoreData.lamp,
|
||||
lampIndex: lamps[c.game].indexOf(c.scoreData.lamp),
|
||||
percent: c.scoreData.percent,
|
||||
score: c.scoreData.score,
|
||||
judgements: c.scoreData.judgements,
|
||||
hitMeta: c.scoreData.hitMeta,
|
||||
},
|
||||
scoreMeta: {},
|
||||
};
|
||||
|
||||
if (c.scoreMeta) {
|
||||
if (base.game === "iidx") {
|
||||
ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom");
|
||||
ConditionalAssign(base.scoreMeta, "gauge", c.scoreMeta, "optionsGauge");
|
||||
ConditionalAssign(base.scoreMeta, "assist", c.scoreMeta, "optionsAssist");
|
||||
ConditionalAssign(base.scoreMeta, "range", c.scoreMeta, "optionsRange");
|
||||
ConditionalAssign(base.scoreMeta, "pacemaker", c.scoreMeta, "pacemaker");
|
||||
ConditionalAssign(base.scoreMeta, "pacemakerName", c.scoreMeta, "pacemakerName");
|
||||
ConditionalAssign(base.scoreMeta, "pacemakerTarget", c.scoreMeta, "pacemakerTarget");
|
||||
if (c.scoreMeta) {
|
||||
if (base.game === "iidx") {
|
||||
ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom");
|
||||
ConditionalAssign(base.scoreMeta, "gauge", c.scoreMeta, "optionsGauge");
|
||||
ConditionalAssign(base.scoreMeta, "assist", c.scoreMeta, "optionsAssist");
|
||||
ConditionalAssign(base.scoreMeta, "range", c.scoreMeta, "optionsRange");
|
||||
ConditionalAssign(base.scoreMeta, "pacemaker", c.scoreMeta, "pacemaker");
|
||||
ConditionalAssign(base.scoreMeta, "pacemakerName", c.scoreMeta, "pacemakerName");
|
||||
ConditionalAssign(base.scoreMeta, "pacemakerTarget", c.scoreMeta, "pacemakerTarget");
|
||||
|
||||
if (base.playtype === "DP" && !Array.isArray(base.scoreMeta.random)) {
|
||||
base.scoreMeta.random = null;
|
||||
}
|
||||
if (base.playtype === "DP" && !Array.isArray(base.scoreMeta.random)) {
|
||||
base.scoreMeta.random = null;
|
||||
}
|
||||
|
||||
// @ts-expect-error asdf
|
||||
if (base.scoreMeta.range === "") {
|
||||
// @ts-expect-error asdf
|
||||
base.scoreMeta.range = "NONE";
|
||||
}
|
||||
} else if (base.game === "bms") {
|
||||
ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom");
|
||||
ConditionalAssign(base.scoreMeta, "inputDevice", c.scoreData.hitMeta, "inputDevice");
|
||||
}
|
||||
}
|
||||
// @ts-expect-error asdf
|
||||
if (base.scoreMeta.range === "") {
|
||||
// @ts-expect-error asdf
|
||||
base.scoreMeta.range = "NONE";
|
||||
}
|
||||
} else if (base.game === "bms") {
|
||||
ConditionalAssign(base.scoreMeta, "random", c.scoreMeta, "optionsRandom");
|
||||
ConditionalAssign(base.scoreMeta, "inputDevice", c.scoreData.hitMeta, "inputDevice");
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error shut
|
||||
if (base.scoreData.hitMeta.bp === -1 || Number.isNaN(base.scoreData.hitMeta.bp)) {
|
||||
// @ts-expect-error shut
|
||||
base.scoreData.hitMeta.bp = null;
|
||||
}
|
||||
// @ts-expect-error shut
|
||||
if (base.scoreData.hitMeta.bp === -1 || Number.isNaN(base.scoreData.hitMeta.bp)) {
|
||||
// @ts-expect-error shut
|
||||
base.scoreData.hitMeta.bp = null;
|
||||
}
|
||||
|
||||
if (base.game === "iidx") {
|
||||
// @ts-expect-error nope
|
||||
if (base.scoreData.hitMeta.gauge > 200) {
|
||||
// @ts-expect-error nope
|
||||
base.scoreData.hitMeta.gauge = null;
|
||||
}
|
||||
if (base.game === "iidx") {
|
||||
// @ts-expect-error nope
|
||||
if (base.scoreData.hitMeta.gauge > 200) {
|
||||
// @ts-expect-error nope
|
||||
base.scoreData.hitMeta.gauge = null;
|
||||
}
|
||||
|
||||
// @ts-expect-error nope
|
||||
if (base.scoreData.hitMeta.gaugeHistory) {
|
||||
// @ts-expect-error nope
|
||||
base.scoreData.hitMeta.gaugeHistory = base.scoreData.hitMeta.gaugeHistory.map((e) =>
|
||||
e > 200 ? null : e
|
||||
);
|
||||
}
|
||||
} else if (base.game === "bms") {
|
||||
// @ts-expect-error shut
|
||||
if (base.scoreData.hitMeta.gauge === -1) {
|
||||
// @ts-expect-error shut
|
||||
base.scoreData.hitMeta.gauge = null;
|
||||
}
|
||||
// @ts-expect-error nope
|
||||
if (base.scoreData.hitMeta.gaugeHistory) {
|
||||
// @ts-expect-error nope
|
||||
base.scoreData.hitMeta.gaugeHistory = base.scoreData.hitMeta.gaugeHistory.map((e) =>
|
||||
e > 200 ? null : e
|
||||
);
|
||||
}
|
||||
} else if (base.game === "bms") {
|
||||
// @ts-expect-error shut
|
||||
if (base.scoreData.hitMeta.gauge === -1) {
|
||||
// @ts-expect-error shut
|
||||
base.scoreData.hitMeta.gauge = null;
|
||||
}
|
||||
|
||||
// @ts-expect-error shut
|
||||
delete base.scoreData.hitMeta.inputDevice;
|
||||
} else if (base.game === "sdvx" || base.game === "usc") {
|
||||
ConditionalAssign(base.scoreData.hitData, "miss", base.scoreData.hitData, "error");
|
||||
// @ts-expect-error shut
|
||||
delete base.scoreData.hitMeta.inputDevice;
|
||||
} else if (base.game === "sdvx" || base.game === "usc") {
|
||||
ConditionalAssign(base.scoreData.judgements, "miss", base.scoreData.judgements, "error");
|
||||
|
||||
//@ts-expect-error yea
|
||||
delete base.scoreData.hitData.error;
|
||||
} else if (base.game === "chunithm") {
|
||||
if (base.scoreData.percent === 101) {
|
||||
base.scoreData.grade === "SSS";
|
||||
}
|
||||
}
|
||||
//@ts-expect-error yea
|
||||
delete base.scoreData.judgements.error;
|
||||
} else if (base.game === "chunithm") {
|
||||
if (base.scoreData.percent === 101) {
|
||||
base.scoreData.grade === "SSS";
|
||||
}
|
||||
}
|
||||
|
||||
if (base.service === "mm") {
|
||||
base.service = "maimagic";
|
||||
}
|
||||
if (base.service === "mm") {
|
||||
base.service = "maimagic";
|
||||
}
|
||||
|
||||
const scoreID = CreateScoreID(base.userID, base, base.chartID);
|
||||
const scoreID = CreateScoreID(base.userID, base, base.chartID);
|
||||
|
||||
const score: ScoreDocument = {
|
||||
...base,
|
||||
scoreID,
|
||||
};
|
||||
const score: ScoreDocument = {
|
||||
...base,
|
||||
scoreID,
|
||||
};
|
||||
|
||||
return score;
|
||||
return score;
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await MigrateRecords(db.scores, "scores", ConvertFn);
|
||||
await MigrateRecords(db.scores, "scores", ConvertFn);
|
||||
|
||||
process.exit(0);
|
||||
process.exit(0);
|
||||
})();
|
||||
|
||||
Vendored
+2
-2
@@ -67,7 +67,7 @@ export const PR_SCORE_GENERIC = {
|
||||
grade: "string",
|
||||
lampIndex: p.isPositiveInteger,
|
||||
gradeIndex: p.isPositiveInteger,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {},
|
||||
},
|
||||
scoreMeta: {},
|
||||
@@ -118,7 +118,7 @@ const CreateGameScoreData = (game: Game, hitMetaMerge: PrudenceSchema) => ({
|
||||
p.isPositiveInteger,
|
||||
(self, parent) => grades[game][self as number] === parent.grade
|
||||
),
|
||||
hitData: Object.fromEntries(validHitData[game].map((e) => [e, optionalPositiveInt])),
|
||||
judgements: Object.fromEntries(validjudgements[game].map((e) => [e, optionalPositiveInt])),
|
||||
hitMeta: deepmerge(
|
||||
{
|
||||
fast: nullableAndOptionalPosInt,
|
||||
|
||||
@@ -141,7 +141,7 @@ t.test("#ReprocessOrphan", (t) => {
|
||||
score: 500,
|
||||
grade: "E",
|
||||
percent: 31.806615776081426,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {},
|
||||
},
|
||||
highlight: false,
|
||||
|
||||
@@ -44,7 +44,7 @@ t.test("#CreatePBDoc", (t) => {
|
||||
esd: IIDXScore.scoreData.esd,
|
||||
grade: IIDXScore.scoreData.grade,
|
||||
gradeIndex: IIDXScore.scoreData.gradeIndex,
|
||||
hitData: IIDXScore.scoreData.hitData,
|
||||
judgements: IIDXScore.scoreData.judgements,
|
||||
lamp: "FULL COMBO",
|
||||
lampIndex: lamps.indexOf("FULL COMBO"),
|
||||
hitMeta: { bp: 1 },
|
||||
|
||||
@@ -141,7 +141,7 @@ async function MergeScoreLampIntoPB(
|
||||
gradeIndex: scorePB.scoreData.gradeIndex,
|
||||
lamp: lampPB.scoreData.lamp,
|
||||
lampIndex: lampPB.scoreData.lampIndex,
|
||||
hitData: scorePB.scoreData.hitData,
|
||||
judgements: scorePB.scoreData.judgements,
|
||||
hitMeta: scorePB.scoreData.hitMeta, // this will probably be overrode by game-specific fns
|
||||
},
|
||||
calculatedData: scorePB.calculatedData,
|
||||
|
||||
@@ -32,7 +32,7 @@ t.test("#ConvertAPIArcDDR", (t) => {
|
||||
grade: "AAA",
|
||||
percent: 99.976,
|
||||
score: 807,
|
||||
hitData: {
|
||||
judgements: {
|
||||
marvelous: 236,
|
||||
perfect: 24,
|
||||
great: 0,
|
||||
|
||||
@@ -90,7 +90,7 @@ export const ConvertAPIArcDDR: ConverterFunction<unknown, EmptyObject> = async (
|
||||
grade,
|
||||
percent,
|
||||
score: score.ex_score,
|
||||
hitData: {
|
||||
judgements: {
|
||||
marvelous: score.judgments.marvelous,
|
||||
perfect: score.judgments.perfect,
|
||||
great: score.judgments.great,
|
||||
|
||||
@@ -29,7 +29,7 @@ t.test("#ConvertAPIArcIIDX", (t) => {
|
||||
scoreData: {
|
||||
grade: "A",
|
||||
score: 1200,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
bp: 43,
|
||||
},
|
||||
|
||||
@@ -78,7 +78,7 @@ export const ConvertAPIArcIIDX: ConverterFunction<unknown, EmptyObject> = async
|
||||
grade,
|
||||
percent,
|
||||
score: score.ex_score,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
bp: score.miss_count,
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@ t.test("#ConvertAPIArcSDVX", (t) => {
|
||||
grade: "AA",
|
||||
percent: 93.125,
|
||||
score: 9312500,
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: 946,
|
||||
near: 45,
|
||||
miss: 49,
|
||||
|
||||
@@ -74,7 +74,7 @@ export const ConvertAPIArcSDVX: ConverterFunction<unknown, EmptyObject> = async
|
||||
grade,
|
||||
percent,
|
||||
score: score.score,
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: score.critical,
|
||||
near: score.near,
|
||||
miss: score.error,
|
||||
|
||||
@@ -35,7 +35,7 @@ t.test("#ConvertAPIKaiIIDX", (t) => {
|
||||
// percent: 99.87277353689568 floating point,
|
||||
score: 1570,
|
||||
lamp: "HARD CLEAR",
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
fast: null,
|
||||
slow: null,
|
||||
|
||||
@@ -108,7 +108,7 @@ export const ConvertAPIKaiIIDX: ConverterFunction<unknown, KaiContext> = async (
|
||||
percent,
|
||||
score: score.ex_score,
|
||||
lamp,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
fast: score.fast_count,
|
||||
slow: score.slow_count,
|
||||
|
||||
@@ -35,7 +35,7 @@ t.test("#ConvertAPIKaiSDVX", (t) => {
|
||||
// percent: 93.10699, floating point
|
||||
score: 9310699,
|
||||
lamp: "EXCESSIVE CLEAR",
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
fast: 70,
|
||||
slow: 42,
|
||||
|
||||
@@ -85,7 +85,7 @@ export const ConvertAPIKaiSDVX: ConverterFunction<unknown, KaiContext> = async (
|
||||
percent,
|
||||
score: score.score,
|
||||
lamp,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
fast: score.early,
|
||||
slow: score.late,
|
||||
|
||||
@@ -364,7 +364,7 @@ t.test("#ConverterFn", (t) => {
|
||||
score: 500,
|
||||
grade: "E",
|
||||
// percent: 31.5, -- ish, FPA is hard.
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {},
|
||||
},
|
||||
scoreMeta: {},
|
||||
|
||||
@@ -272,9 +272,9 @@ t.test("#ParserFn", (t) => {
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Valid HitData", (t) => {
|
||||
t.test("Valid judgements", (t) => {
|
||||
const res = ParserFn(
|
||||
dm({ hitData: { pgreat: 1, great: null, bad: 0 } }),
|
||||
dm({ judgements: { pgreat: 1, great: null, bad: 0 } }),
|
||||
"file/batch-manual",
|
||||
logger
|
||||
);
|
||||
@@ -294,7 +294,7 @@ t.test("#ParserFn", (t) => {
|
||||
identifier: "123",
|
||||
playtype: "SP",
|
||||
difficulty: "ANOTHER",
|
||||
hitData: {
|
||||
judgements: {
|
||||
pgreat: 1,
|
||||
great: null,
|
||||
bad: 0,
|
||||
@@ -424,18 +424,18 @@ t.test("#ParserFn", (t) => {
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Invalid HitData", (t) => {
|
||||
t.test("Invalid judgements", (t) => {
|
||||
const fn = () =>
|
||||
ParserFn(dm({ hitData: { not_key: 123 } }), "file/batch-manual", logger);
|
||||
ParserFn(dm({ judgements: { not_key: 123 } }), "file/batch-manual", logger);
|
||||
|
||||
t.throws(fn, mockErr("body[0].hitData | Invalid Key not_key"));
|
||||
t.throws(fn, mockErr("body[0].judgements | Invalid Key not_key"));
|
||||
|
||||
const fn2 = () =>
|
||||
ParserFn(dm({ hitData: { pgreat: "123" } }), "file/batch-manual", logger);
|
||||
ParserFn(dm({ judgements: { pgreat: "123" } }), "file/batch-manual", logger);
|
||||
|
||||
t.throws(
|
||||
fn2,
|
||||
mockErr("body[0].hitData | Key pgreat had an invalid value of 123 [string]")
|
||||
mockErr("body[0].judgements | Key pgreat had an invalid value of 123 [string]")
|
||||
);
|
||||
|
||||
t.end();
|
||||
|
||||
@@ -74,7 +74,7 @@ const PR_BatchManualScore = (game: Game, playtype: Playtypes[Game]): PrudenceSch
|
||||
(typeof self === "number" && self > 1_000_000_000_000) ||
|
||||
"Expected a number greater than 1 Trillion - did you pass unix seconds instead of miliseconds?"
|
||||
),
|
||||
hitData: optNull((self) => {
|
||||
judgements: optNull((self) => {
|
||||
if (typeof self !== "object" || self === null) {
|
||||
return "Not a valid object.";
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ const ConvertEamIIDXCSV: ConverterFunction<IIDXEamusementCSVData, IIDXEamusement
|
||||
scoreData: {
|
||||
score: exscore,
|
||||
lamp,
|
||||
hitData: {
|
||||
judgements: {
|
||||
pgreat,
|
||||
great,
|
||||
},
|
||||
|
||||
@@ -42,7 +42,7 @@ t.test("#ConvertFileMerIIDX", (t) => {
|
||||
// percent: 63.61, approximately, fpa impossible.
|
||||
grade: "B",
|
||||
lamp: "CLEAR",
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
bp: 21,
|
||||
},
|
||||
@@ -76,7 +76,7 @@ t.test("#ConvertFileMerIIDX", (t) => {
|
||||
// percent: 63.61, approximately, fpa impossible.
|
||||
grade: "B",
|
||||
lamp: "CLEAR",
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
bp: 21,
|
||||
},
|
||||
|
||||
@@ -64,7 +64,7 @@ export const ConvertFileMerIIDX: ConverterFunction<MerScore, EmptyObject> = asyn
|
||||
percent,
|
||||
grade,
|
||||
lamp,
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
bp: data.miss_count === -1 ? null : data.miss_count,
|
||||
},
|
||||
|
||||
@@ -38,7 +38,7 @@ t.test("#ConvertFileS3", (t) => {
|
||||
grade: "F",
|
||||
score: 100,
|
||||
lamp: "FULL COMBO",
|
||||
hitData: {
|
||||
judgements: {
|
||||
pgreat: 25,
|
||||
great: 50,
|
||||
good: 0,
|
||||
|
||||
@@ -142,9 +142,9 @@ export const ConvertFileS3: ConverterFunction<S3Score, EmptyObject> = async (
|
||||
|
||||
const timeAchieved = ParseDateFromString(data.date);
|
||||
|
||||
let hitData = {};
|
||||
let judgements = {};
|
||||
if (data.scorebreakdown) {
|
||||
hitData = {
|
||||
judgements = {
|
||||
pgreat: data.scorebreakdown.justgreats,
|
||||
great: data.scorebreakdown.greats,
|
||||
good: data.scorebreakdown.good,
|
||||
@@ -163,7 +163,7 @@ export const ConvertFileS3: ConverterFunction<S3Score, EmptyObject> = async (
|
||||
grade: grade as Grades["iidx:SP" | "iidx:DP"],
|
||||
score: data.exscore,
|
||||
lamp,
|
||||
hitData,
|
||||
judgements,
|
||||
hitMeta: {},
|
||||
},
|
||||
scoreMeta: {},
|
||||
|
||||
@@ -61,7 +61,7 @@ t.test("#ConverterIRBarbatos", (t) => {
|
||||
percent: 90,
|
||||
grade: "A+",
|
||||
lamp: "CLEAR",
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: 100,
|
||||
near: 50,
|
||||
miss: 5,
|
||||
|
||||
@@ -71,7 +71,7 @@ export const ConverterIRBarbatos: ConverterFunction<BarbatosScore, EmptyObject>
|
||||
percent,
|
||||
grade,
|
||||
lamp: LAMP_LOOKUP[data.clear_type] as Lamps["sdvx:Single"],
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: data.critical,
|
||||
near: data.near_total,
|
||||
miss: data.error,
|
||||
|
||||
@@ -73,7 +73,7 @@ export const ConverterIRBeatoraja: ConverterFunction<BeatorajaScore, BeatorajaCo
|
||||
gauge: data.gauge === -1 ? null : data.gauge,
|
||||
};
|
||||
|
||||
let hitData: DryScore<"bms:7K" | "bms:14K">["scoreData"]["hitData"] = {};
|
||||
let judgements: DryScore<"bms:7K" | "bms:14K">["scoreData"]["judgements"] = {};
|
||||
|
||||
// if NOT CN mode we can assign judgements properly
|
||||
if (data.lntype === 0) {
|
||||
@@ -95,7 +95,7 @@ export const ConverterIRBeatoraja: ConverterFunction<BeatorajaScore, BeatorajaCo
|
||||
hitMeta.epr! += data.ems;
|
||||
hitMeta.lpr! += data.lms;
|
||||
|
||||
hitData = {
|
||||
judgements = {
|
||||
pgreat: data.epg + data.lpg,
|
||||
great: data.egr + data.lgr,
|
||||
good: data.egd + data.lgd,
|
||||
@@ -122,7 +122,7 @@ export const ConverterIRBeatoraja: ConverterFunction<BeatorajaScore, BeatorajaCo
|
||||
score: data.exscore,
|
||||
lamp,
|
||||
hitMeta,
|
||||
hitData,
|
||||
judgements,
|
||||
},
|
||||
scoreMeta: {
|
||||
client: context.client,
|
||||
|
||||
@@ -54,7 +54,7 @@ export const ConverterIRFervidexStatic: ConverterFunction<
|
||||
percent,
|
||||
grade,
|
||||
lamp: FERVIDEX_LAMP_LOOKUP[data.clear_type] as Lamps["iidx:SP" | "iidx:DP"],
|
||||
hitData: {},
|
||||
judgements: {},
|
||||
hitMeta: {
|
||||
bp: data.miss_count === -1 ? null : data.miss_count,
|
||||
},
|
||||
|
||||
@@ -94,7 +94,7 @@ const baseDryScore = {
|
||||
percent: 4.325699745547074,
|
||||
grade: "F",
|
||||
lamp: "FAILED",
|
||||
hitData: {
|
||||
judgements: {
|
||||
pgreat: 34,
|
||||
great: 0,
|
||||
good: 0,
|
||||
|
||||
@@ -189,7 +189,7 @@ export const ConverterIRFervidex: ConverterFunction<FervidexScore, FervidexConte
|
||||
percent,
|
||||
grade,
|
||||
lamp: FERVIDEX_LAMP_LOOKUP[data.clear_type] as Lamps["iidx:SP" | "iidx:DP"],
|
||||
hitData: {
|
||||
judgements: {
|
||||
pgreat: data.pgreat,
|
||||
great: data.great,
|
||||
good: data.good,
|
||||
|
||||
@@ -91,7 +91,7 @@ export const ConverterIRUSC: ConverterFunction<USCClientScore, IRUSCContext> = a
|
||||
percent,
|
||||
score: data.score,
|
||||
lamp: DeriveLamp(data, logger),
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: data.crit,
|
||||
near: data.near,
|
||||
miss: data.error,
|
||||
|
||||
@@ -124,7 +124,7 @@ const USC_SCORE_PB: PBScoreDocument = {
|
||||
lamp: "EXCESSIVE CLEAR",
|
||||
lampIndex: 2,
|
||||
gradeIndex: 4, // idk, lazy
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: 50,
|
||||
near: 30,
|
||||
miss: 10,
|
||||
|
||||
@@ -28,7 +28,7 @@ const mockScorePB: PBScoreDocument<"usc:Single"> = {
|
||||
esd: null,
|
||||
grade: "AAA+",
|
||||
gradeIndex: 7,
|
||||
hitData: {
|
||||
judgements: {
|
||||
critical: 100,
|
||||
miss: 15,
|
||||
},
|
||||
|
||||
@@ -69,9 +69,9 @@ export async function TachiScoreToServerScore(
|
||||
return {
|
||||
score: tachiScore.scoreData.score,
|
||||
timestamp: MStoS(tachiScore.timeAchieved ?? 0),
|
||||
crit: tachiScore.scoreData.hitData.critical ?? 0,
|
||||
near: tachiScore.scoreData.hitData.near ?? 0,
|
||||
error: tachiScore.scoreData.hitData.miss ?? 0,
|
||||
crit: tachiScore.scoreData.judgements.critical ?? 0,
|
||||
near: tachiScore.scoreData.judgements.near ?? 0,
|
||||
error: tachiScore.scoreData.judgements.miss ?? 0,
|
||||
ranking: tachiScore.rankingData.rank,
|
||||
lamp: TACHI_LAMP_TO_USC[tachiScore.scoreData.lamp],
|
||||
username: userDoc.username,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"esd": 30,
|
||||
"gradeIndex": 3,
|
||||
"lampIndex": 4,
|
||||
"hitData": {
|
||||
"judgements": {
|
||||
"pgreat": 50,
|
||||
"great": 10
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"percent": 70.76,
|
||||
"grade": "B",
|
||||
"esd": 30,
|
||||
"hitData": {},
|
||||
"judgements": {},
|
||||
"hitMeta": {}
|
||||
},
|
||||
"scoreMeta": {},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"lamp": "CLEAR",
|
||||
"percent": 50,
|
||||
"grade": "C",
|
||||
"hitData": {
|
||||
"judgements": {
|
||||
"pgreat": 50,
|
||||
"great": 10
|
||||
},
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"esd": 30,
|
||||
"gradeIndex": 3,
|
||||
"lampIndex": 4,
|
||||
"hitData": {
|
||||
"judgements": {
|
||||
"pgreat": 50,
|
||||
"great": 10
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"gradeIndex": -1,
|
||||
"lamp": "EX HARD CLEAR",
|
||||
"lampIndex": 6,
|
||||
"hitData": {
|
||||
"judgements": {
|
||||
"pgreat": 697,
|
||||
"great": 85
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"percent": 95,
|
||||
"grade": "AA+",
|
||||
"esd": null,
|
||||
"hitData": {},
|
||||
"judgements": {},
|
||||
"hitMeta": {}
|
||||
},
|
||||
"scoreMeta": {},
|
||||
|
||||
Reference in New Issue
Block a user