Assorted Database Fixes

This commit is contained in:
zkldi
2021-09-07 16:41:22 +01:00
parent 2c2b089a70
commit d3f8e2c0da
8 changed files with 257 additions and 72 deletions
+1 -1
View File
@@ -73,7 +73,7 @@
"redis": "3.1.2",
"rimraf": "3.0.2",
"safe-json-stringify": "1.2.0",
"tachi-common": "0.2.5",
"tachi-common": "0.2.7",
"typescript": "4.3.4",
"winston": "3.3.3"
},
+244 -8
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -83,7 +83,7 @@ function ConvertVersion(c: string): any {
if (!relevantVersions.includes("27-omni") && !relevantVersions.includes("inf")) {
if (relevantVersions.includes("26-omni")) {
logger.info(
`Song ${song.title} (${playtype} ${difficulty}) was a very recent removal. Consider deprimarifying it.(had ${relevantVersions})`,
`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 {
@@ -96,9 +96,10 @@ function ConvertVersion(c: string): any {
continue;
}
// logger.info(relevantVersions);
const chart = await db.charts.iidx.findOne({ songID: song.id, difficulty, playtype });
const chart = await db.charts.iidx.findOne(
{ songID: song.id, difficulty, playtype },
{ projectID: true }
);
if (!chart) {
logger.error(`Can't find chart ${song.title} (${playtype} ${difficulty})`);
-12
View File
@@ -1,12 +0,0 @@
{
"name": "tachi-server-scripts",
"version": "0.0.0",
"description": "Scripts and their dependencies for Tachi-Server. This lets us separate dependencies to avoid unecessary overhead in the CI/CD pipeline.",
"main": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
@@ -1,33 +0,0 @@
import monk from "monk";
import fs from "fs";
import path from "path";
import { Command } from "commander";
import CreateLogCtx from "../src/common/logger";
const program = new Command();
const logger = CreateLogCtx(__filename);
program.option("-c, --collection <collection>", "The collection to fetch tachi data from.");
program.parse(process.argv);
const options = program.opts();
const collection = options.collection;
logger.info(`Connecting to ${process.env.MONGO_BASE_URL}/ktblackdb...`);
const ktBlackDB = monk(`${process.env.MONGO_BASE_URL}/ktblackdb`);
(async () => {
logger.info(`Fetching data for ${collection}...`);
const data = await ktBlackDB.get(collection).find({}, { projection: { _id: 0 } });
logger.info(`Fetched ${data.length} documents, Writing...`);
fs.writeFileSync(
path.join(__dirname, `../src/test-utils/test-data/tachi/ktblack-${collection}.json`),
JSON.stringify(data)
);
logger.info("Done!");
process.exit(0);
})();
+6 -13
View File
@@ -3,14 +3,13 @@ import fetch from "node-fetch";
import { Command } from "commander";
import fs from "fs";
import path from "path";
import { config, Difficulties, ESDCore, IIDXBPIData, ChartDocument } from "tachi-common";
import { FindSongOnTitle } from "../src/score-import/database-lookup/song-title";
import {
FindChartWithPTDF,
FindChartWithPTDFVersion,
} from "../src/score-import/database-lookup/chart-ptdf";
import { Difficulties, ESDCore, IIDXBPIData, ChartDocument } from "tachi-common";
import db from "external/mongo/db";
import CreateLogCtx from "../src/common/logger";
import CreateLogCtx from "lib/logger/logger";
import { config } from "process";
import { FindChartWithPTDFVersion } from "utils/queries/charts";
import { FindSongOnTitle } from "utils/queries/songs";
const program = new Command();
const logger = CreateLogCtx(__filename);
@@ -91,17 +90,11 @@ async function UpdatePoyashiData() {
continue;
}
const kesd = ESDCore.CalculateESD(
config.judgementWindows.iidx.SP,
kavg / (tachiChart.data.notecount * 2)
);
realData.push({
coef: d.coef === -1 ? null : d.coef,
kavg: Number(d.avg),
wr: Number(d.wr),
chartID: tachiChart.chartID,
kesd,
});
}