analysis WiP

This commit is contained in:
2026-05-23 20:07:14 +05:30
parent 0bb486223e
commit 9bb0af59b0
11 changed files with 1031 additions and 5 deletions
+3 -1
View File
@@ -40,7 +40,9 @@ export async function addSystemSupply(formData: FormData) {
? "matchmaker"
: tabRaw === "ledger"
? "ledger"
: "dashboard";
: tabRaw === "analysis"
? "analysis"
: "dashboard";
const highlightRaw = String(formData.get("highlightId") ?? "").trim();
const participantRaw = String(formData.get("participantRaw") ?? "").trim();
+3 -1
View File
@@ -35,7 +35,9 @@ export async function updateUserCcRc(formData: FormData) {
? "matchmaker"
: tabRaw === "ledger"
? "ledger"
: "dashboard";
: tabRaw === "analysis"
? "analysis"
: "dashboard";
const highlightRaw = String(formData.get("highlightId") ?? "").trim();
const participantRaw = String(formData.get("participantRaw") ?? "").trim();
const highlightId = highlightRaw === "" ? null : highlightRaw;
+35 -1
View File
@@ -19,6 +19,12 @@ import {
} from "@/lib/matchmaker-log-source";
import { readMatchmakerLogFile } from "@/lib/matchmaker-logs-server";
import { fetchMatchEntryHoldAndFeePerPlayerCoinsByMatchIds } from "@/lib/match-entry-hold-from-ledger";
import {
analyzeMatchLogsForMatches,
parseAnalysisPlayerIds,
} from "@/lib/match-log-analysis-server";
import type { MatchLogAnalysisResult } from "@/lib/match-log-parser";
import { emptyMatchLogAnalysisResult } from "@/lib/match-log-parser";
import type {
AdminMatchRow,
DbMatch,
@@ -63,6 +69,9 @@ export default async function Home({
lsize?: string | string[];
lsort?: string | string[];
lorder?: string | string[];
afrom?: string | string[];
ato?: string | string[];
aplayers?: string | string[];
}>;
}) {
const sp = await searchParams;
@@ -76,7 +85,9 @@ export default async function Home({
? "matchmaker"
: tabParam === "ledger"
? "ledger"
: "dashboard";
: tabParam === "analysis"
? "analysis"
: "dashboard";
const highlightId = firstSearchParam(sp.highlight);
const participantRaw = firstSearchParam(sp.participant);
const editRaw = firstSearchParam(sp.edit);
@@ -103,6 +114,10 @@ export default async function Home({
let ledgerSortOrderView: LedgerSortOrder = "desc";
let ledgerFrom = utcLast30DaysDateRange().from;
let ledgerTo = utcLast30DaysDateRange().to;
let analysisFrom = utcLast30DaysDateRange().from;
let analysisTo = utcLast30DaysDateRange().to;
let analysisPlayerIds: number[] = [];
let matchAnalysis: MatchLogAnalysisResult = emptyMatchLogAnalysisResult();
let statsBundle: Awaited<ReturnType<typeof loadDashboardStatsBundle>> | null =
null;
@@ -229,6 +244,21 @@ export default async function Home({
ledgerTotalPagesView = slice.totalPages;
}
}
if (tab === "analysis") {
const afromRaw = firstSearchParam(sp.afrom);
const atoRaw = firstSearchParam(sp.ato);
const range = normalizeLedgerDateRange(afromRaw, atoRaw);
analysisFrom = range.from;
analysisTo = range.to;
analysisPlayerIds = parseAnalysisPlayerIds(sp.aplayers);
matchAnalysis = await analyzeMatchLogsForMatches(
matches,
analysisFrom,
analysisTo,
analysisPlayerIds,
);
}
}
let editUser: DbUser | null = null;
@@ -275,6 +305,10 @@ export default async function Home({
ledgerFrom={ledgerFrom}
ledgerTo={ledgerTo}
supplyError={supplyError}
analysisFrom={analysisFrom}
analysisTo={analysisTo}
analysisPlayerIds={analysisPlayerIds}
matchAnalysis={matchAnalysis}
/>
{editUser ? (
<EditUserCcRcOverlay