experimental: initial autofix blast

This commit is contained in:
zkldi
2022-05-06 03:39:03 +01:00
parent 61ea7a4bf7
commit 0adc39b5cb
275 changed files with 2207 additions and 1877 deletions
+7 -5
View File
@@ -1,7 +1,9 @@
import db from "external/mongo/db";
import CreateLogCtx from "lib/logger/logger";
import { FilterQuery } from "mongodb";
import {
import { GetNextCounterValue } from "utils/db";
import { DedupeArr } from "utils/misc";
import type { FilterQuery } from "mongodb";
import type {
ChartDocument,
IDStrings,
IDStringToGame,
@@ -9,8 +11,6 @@ import {
OrphanChart,
SongDocument,
} from "tachi-common";
import { GetNextCounterValue } from "utils/db";
import { DedupeArr } from "utils/misc";
const logger = CreateLogCtx(__filename);
@@ -39,7 +39,7 @@ export async function HandleOrphanQueue<I extends IDStrings>(
logger.debug(`Received orphanqueue request for ${chartName}.`);
const orphanChart = await db["orphan-chart-queue"].findOne(
Object.assign({ idString }, orphanMatchCriteria),
{ idString, ...orphanMatchCriteria },
{
projectID: true,
}
@@ -63,8 +63,10 @@ export async function HandleOrphanQueue<I extends IDStrings>(
const uniqueUsersArr = DedupeArr(orphanChart.userIDs);
const playcount = uniqueUsersArr.length;
// If N or more people have played this chart while orphaned, unorphan
// it.
if (playcount >= queueSize) {
logger.info(`Song ${chartName} was unorphaned by userIDs ${uniqueUsersArr.join(", ")}.`);
const songID = await GetNextCounterValue(`${game}-song-id`);