From 5268e3f423fcf34ba9bc74ee76a5a244323dd8fa Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 22 Jun 2024 08:35:21 +0000 Subject: [PATCH] remove dependence on player backfill --- store/queries.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/store/queries.ts b/store/queries.ts index e310a6813..18722e141 100644 --- a/store/queries.ts +++ b/store/queries.ts @@ -758,6 +758,7 @@ export async function getMatchDataFromBlobWithMetadata( } } + const basePlayers = api?.players || archived?.players; // Merge the results together const final: Match | ParsedMatch = { ...archived, @@ -766,21 +767,24 @@ export async function getMatchDataFromBlobWithMetadata( ...api, ...identity, ...ranks, - players: api?.players.map((apiPlayer) => { + players: basePlayers?.map((basePlayer) => { + const apiPlayer = api?.players.find( + (apiP) => apiP.player_slot === basePlayer.player_slot, + ); const archivedPlayer = archived?.players.find( - (ap) => ap.player_slot === apiPlayer.player_slot, + (archivedP) => archivedP.player_slot === basePlayer.player_slot, ); const gcPlayer = gcdata?.players.find( - (gcp) => gcp.player_slot === apiPlayer.player_slot, + (gcp) => gcp.player_slot === basePlayer.player_slot, ); const parsedPlayer = parsed?.players.find( - (pp) => pp.player_slot === apiPlayer.player_slot, + (pp) => pp.player_slot === basePlayer.player_slot, ); const identityPlayer = identity?.players.find( - (ip: any) => ip.player_slot === apiPlayer.player_slot, + (ip: any) => ip.player_slot === basePlayer.player_slot, ); const ranksPlayer = ranks?.players.find( - (rp: any) => rp.player_slot === apiPlayer.player_slot, + (rp: any) => rp.player_slot === basePlayer.player_slot, ); return { ...archivedPlayer,