diff --git a/app/core/lanista.ts b/app/core/lanista.ts index fcadc8fa6..b91d088d5 100644 --- a/app/core/lanista.ts +++ b/app/core/lanista.ts @@ -1,6 +1,5 @@ import { Mode } from "@prisma/client"; import { fetchTimeout } from "~/utils"; -import { playersWithResults } from "./play/playerInfos/playerInfos.server"; const LANISTA_REQUEST_TIMEOUT = 7000; @@ -26,19 +25,13 @@ export async function requestMatchDetails({ throw new Error("process.env.LANISTA_URL not set"); } - // there is nothing Lanista can do for us in this case - // -> user should link and try again later manually - if (playersWithResults(playerDiscordIds).length === 0) { - return; - } - const response = await fetchTimeout( process.env.LANISTA_URL, LANISTA_REQUEST_TIMEOUT, { body: JSON.stringify({ maplist: playedStages, - requesterId: playersWithResults(playerDiscordIds), + requesterId: playerDiscordIds, startTime: startTime.toISOString(), endTime: (endTime ?? new Date()).toISOString(), matchId, diff --git a/app/core/play/playerInfos/playerInfos.server.ts b/app/core/play/playerInfos/playerInfos.server.ts index ca7dbd42c..4942b6393 100644 --- a/app/core/play/playerInfos/playerInfos.server.ts +++ b/app/core/play/playerInfos/playerInfos.server.ts @@ -7,7 +7,6 @@ import rawInfos from "./data.json"; const infos = rawInfos as Partial< Record >; -const idsWithResults = new Set(Object.keys(infos)); export function addInfoFromOldSendouInk( type: "LEAGUE" | "SOLO", @@ -36,10 +35,6 @@ export function addInfoFromOldSendouInk( } } -export function playersWithResults(discordIds: string[]): string[] { - return discordIds.filter((id) => idsWithResults.has(id)); -} - export function userHasTop500Result({ discordId }: { discordId?: string }) { if (!discordId) return false; return Boolean(infos[discordId]?.peakXP); diff --git a/scripts/matchesWithoutDetails.ts b/scripts/matchesWithoutDetails.ts index ab9e73251..0b933e76e 100644 --- a/scripts/matchesWithoutDetails.ts +++ b/scripts/matchesWithoutDetails.ts @@ -1,5 +1,4 @@ import { PrismaClient } from "@prisma/client"; -import { playersWithResults } from "~/core/play/playerInfos/playerInfos.server"; import fs from "fs"; const prisma = new PrismaClient(); @@ -21,15 +20,11 @@ async function main() { }[] = []; for (const match of matches) { - const players = playersWithResults( - match.groups.flatMap((g) => g.members).flatMap((m) => m.user.discordId) - ); const mapList = match.stages .sort((a, b) => a.order - b.order) .filter((stage) => stage.winnerGroupId) .map((stage) => ({ map: stage.stage.name, mode: stage.stage.mode })); - if (!players.length) continue; if (!mapList.length) continue; result.push({ @@ -37,7 +32,9 @@ async function main() { mapList, start_time: match.createdAt.toISOString(), end_time: new Date(match.createdAt.getTime() + 60 * 60000).toISOString(), - players, + players: match.groups + .flatMap((g) => g.members) + .flatMap((m) => m.user.discordId), }); }