Add (required/outOf) to USC IR returns, and fix a critical bug with orphan chart locating.

This commit is contained in:
zkldi
2021-12-06 20:08:34 +00:00
parent 01c3177532
commit 5c6f63394d
3 changed files with 31 additions and 5 deletions
+4 -3
View File
@@ -10,6 +10,7 @@ import {
SongDocument,
} from "tachi-common";
import { GetNextCounterValue } from "utils/db";
import { DedupeArr } from "utils/misc";
const logger = CreateLogCtx(__filename);
@@ -35,7 +36,7 @@ export async function HandleOrphanQueue<I extends IDStrings>(
userID: integer,
chartName: string
) {
logger.debug(`received orphanqueue request for ${chartName}.`);
logger.debug(`Received orphanqueue request for ${chartName}.`);
const orphanChart = await db["orphan-chart-queue"].findOne(
Object.assign({ idString }, orphanMatchCriteria),
@@ -45,7 +46,7 @@ export async function HandleOrphanQueue<I extends IDStrings>(
);
if (!orphanChart) {
logger.verbose(`received unknown chart ${chartName}, orphaning.`);
logger.verbose(`Received unknown chart ${chartName}, orphaning.`);
await db["orphan-chart-queue"].insert({
idString,
@@ -59,7 +60,7 @@ export async function HandleOrphanQueue<I extends IDStrings>(
orphanChart.userIDs.push(userID);
const uniqueUsersArr = [...new Set(orphanChart.userIDs)];
const uniqueUsersArr = DedupeArr(orphanChart.userIDs);
const playcount = uniqueUsersArr.length;
// If N or more people have played this chart while orphaned, unorphan