mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-07 22:38:02 +03:00
Assorted Database Fixes
This commit is contained in:
+1
-1
@@ -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"
|
||||
},
|
||||
|
||||
Generated
+244
-8
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+5
-4
@@ -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})`);
|
||||
@@ -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);
|
||||
})();
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user