mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-01 11:28:13 +03:00
feat: track bestExScore in PBs
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable require-atomic-updates */
|
||||
import { InternalFailure } from "../common/converter-failures";
|
||||
import db from "external/mongo/db";
|
||||
import { Volforce } from "rg-stats";
|
||||
@@ -139,5 +140,26 @@ export async function SDVXMergeFn(
|
||||
chart.levelNum
|
||||
);
|
||||
|
||||
// find the users score with the highest exScore
|
||||
const bestExScore = (await db.scores.findOne(
|
||||
{
|
||||
chartID: pbDoc.chartID,
|
||||
"scoreData.hitMeta.exScore": { $type: "number" },
|
||||
},
|
||||
{
|
||||
sort: {
|
||||
"scoreData.hitMeta.exScore": -1,
|
||||
},
|
||||
}
|
||||
)) as ScoreDocument<"sdvx:Single"> | null;
|
||||
|
||||
if (!bestExScore) {
|
||||
pbDoc.scoreData.hitMeta.exScore = undefined;
|
||||
} else {
|
||||
pbDoc.scoreData.hitMeta.exScore = bestExScore.scoreData.hitMeta.exScore;
|
||||
|
||||
pbDoc.composedFrom.other = [{ name: "exScorePB", scoreID: bestExScore.scoreID }];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user