Read tricoro info from versions.json

This commit is contained in:
zkldi
2021-09-07 10:44:38 +01:00
parent bdaf8107fd
commit fa958052bc
4 changed files with 45 additions and 7 deletions
@@ -0,0 +1,21 @@
import db from "external/mongo/db";
import { Random20Hex } from "utils/misc";
(async () => {
const docs = await db.charts.iidx.find({ version: "inf" }, { projectID: true });
for (const doc of docs) {
await db.charts.iidx.update(
{
_id: doc._id,
},
{
$set: {
chartID: Random20Hex(),
},
}
);
}
console.log("done");
})();
@@ -19,7 +19,7 @@ const DIFF_MAP = {
X: "LEGGENDARIA",
} as any;
function ConvertVersion(c: string) {
function ConvertVersion(c: string): any {
if (c.startsWith("AC")) {
return c.split("AC")[1];
} else if (c.startsWith("OM")) {
@@ -54,6 +54,12 @@ function ConvertVersion(c: string) {
"OM26",
"AC27",
"AC26",
"AC25",
"AC24",
"AC23",
"AC22",
"AC21",
"AC20",
"INF",
"CS16",
"CS15",
@@ -75,7 +81,18 @@ function ConvertVersion(c: string) {
.map(ConvertVersion);
if (!relevantVersions.includes("27-omni") && !relevantVersions.includes("inf")) {
logger.warn(`Song ${song.title} (${playtype} ${difficulty}) has no relevant versions.`);
if (relevantVersions.includes("26-omni")) {
logger.info(
`Song ${song.title} (${playtype} ${difficulty}) was a very recent removal. Consider deprimarifying it.(had ${relevantVersions})`,
{ keys: Object.keys(data).filter((e) => data[e] === "1") }
);
} else {
logger.verbose(
`Song ${song.title} (${playtype} ${difficulty}) has no relevant versions. (had ${relevantVersions})`,
{ keys: Object.keys(data).filter((e) => data[e] === "1") }
);
}
continue;
}