diff --git a/app/api/analyze/route.ts b/app/api/analyze/route.ts index 7489cf2..48776ba 100644 --- a/app/api/analyze/route.ts +++ b/app/api/analyze/route.ts @@ -33,6 +33,8 @@ interface PlayerFullDataResponse { playerDetails: Record; }; }; + // WCL report rankings blob — only `partition` is consumed (phase scoping) + rankings?: { data?: Array<{ fightID?: number; partition?: number }> }; damage?: { data: { entries: WCLDamageEntry[] } }; healing?: { data: { entries: WCLDamageEntry[] } }; buffs: { data: { auras: WCLBuffEntry[] } }; @@ -207,6 +209,13 @@ export async function POST(request: NextRequest) { ); } + // Scope rankings to the report's own partition (raid phase). Without it, + // WCL falls back to the zone's default partition, which can compare an + // earlier-phase log against later-phase-geared top parses (inflated DPS). + const fightPartition = report.rankings?.data?.find( + (r) => r.fightID === fightId + )?.partition ?? report.rankings?.data?.[0]?.partition; + let rankingsData: WCLRankingsData; try { const rankingsResponse = await wclQuery( @@ -216,6 +225,7 @@ export async function POST(request: NextRequest) { className: playerClass, specName: playerSpec, metric: playerRole === "healer" ? "hps" : "dps", + partition: typeof fightPartition === "number" ? fightPartition : null, } ); rankingsData = rankingsResponse.worldData.encounter.characterRankings; diff --git a/lib/wcl-queries.ts b/lib/wcl-queries.ts index 205381c..d1ce54d 100644 --- a/lib/wcl-queries.ts +++ b/lib/wcl-queries.ts @@ -86,6 +86,7 @@ export const PLAYER_FULL_DATA_QUERY_HEALING = ` reportData { report(code: $code) { playerDetails(fightIDs: $fightIDs) + rankings(fightIDs: $fightIDs) healing: table( dataType: Healing fightIDs: $fightIDs @@ -225,6 +226,7 @@ export const PLAYER_FULL_DATA_QUERY = ` reportData { report(code: $code) { playerDetails(fightIDs: $fightIDs) + rankings(fightIDs: $fightIDs) damage: table( dataType: DamageDone fightIDs: $fightIDs