mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Fix match page slowness (#2573)
This commit is contained in:
parent
88dcd43741
commit
54ef0305a3
|
|
@ -130,12 +130,14 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
|
|||
maps: match.maps,
|
||||
pickBanEvents,
|
||||
recentlyPlayedMaps:
|
||||
await TournamentTeamRepository.findRecentlyPlayedMapsByIds({
|
||||
teamIds: [match.opponentOne.id, match.opponentTwo.id],
|
||||
}).catch((error) => {
|
||||
logger.error("Failed to fetch recently played maps", error);
|
||||
return [];
|
||||
}),
|
||||
match.mapPickingStyle !== "TO"
|
||||
? await TournamentTeamRepository.findRecentlyPlayedMapsByIds({
|
||||
teamIds: [match.opponentOne.id, match.opponentTwo.id],
|
||||
}).catch((error) => {
|
||||
logger.error("Failed to fetch recently played maps", error);
|
||||
return [];
|
||||
})
|
||||
: undefined,
|
||||
}).map((mapListMap) => {
|
||||
return {
|
||||
map: {
|
||||
|
|
|
|||
|
|
@ -95,12 +95,14 @@ export const action: ActionFunction = async ({ params, request }) => {
|
|||
maps: match.roundMaps,
|
||||
pickBanEvents,
|
||||
recentlyPlayedMaps:
|
||||
await TournamentTeamRepository.findRecentlyPlayedMapsByIds({
|
||||
teamIds: [match.opponentOne.id, match.opponentTwo.id],
|
||||
}).catch((error) => {
|
||||
logger.error("Failed to fetch recently played maps", error);
|
||||
return [];
|
||||
}),
|
||||
match.mapPickingStyle !== "TO"
|
||||
? await TournamentTeamRepository.findRecentlyPlayedMapsByIds({
|
||||
teamIds: [match.opponentOne.id, match.opponentTwo.id],
|
||||
}).catch((error) => {
|
||||
logger.error("Failed to fetch recently played maps", error);
|
||||
return [];
|
||||
})
|
||||
: undefined,
|
||||
})
|
||||
: null;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ interface ResolveCurrentMapListArgs {
|
|||
type: Tables["TournamentMatchPickBanEvent"]["type"];
|
||||
}>;
|
||||
/** Maps that both teams (interleaved) have recently played in the tournament with the most recent being first. */
|
||||
recentlyPlayedMaps: Array<{ mode: ModeShort; stageId: StageId }>;
|
||||
recentlyPlayedMaps?: Array<{ mode: ModeShort; stageId: StageId }>;
|
||||
}
|
||||
|
||||
export function resolveMapList(
|
||||
|
|
|
|||
|
|
@ -37,12 +37,14 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
|
|||
maps: match.roundMaps,
|
||||
pickBanEvents,
|
||||
recentlyPlayedMaps:
|
||||
await TournamentTeamRepository.findRecentlyPlayedMapsByIds({
|
||||
teamIds: [match.opponentOne.id, match.opponentTwo.id],
|
||||
}).catch((error) => {
|
||||
logger.error("Failed to fetch recently played maps", error);
|
||||
return [];
|
||||
}),
|
||||
match.mapPickingStyle !== "TO"
|
||||
? await TournamentTeamRepository.findRecentlyPlayedMapsByIds({
|
||||
teamIds: [match.opponentOne.id, match.opponentTwo.id],
|
||||
}).catch((error) => {
|
||||
logger.error("Failed to fetch recently played maps", error);
|
||||
return [];
|
||||
})
|
||||
: undefined,
|
||||
})
|
||||
: null;
|
||||
|
||||
|
|
|
|||
7
migrations/098-tournament-match-game-result-indexes.js
Normal file
7
migrations/098-tournament-match-game-result-indexes.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export function up(db) {
|
||||
db.transaction(() => {
|
||||
db.prepare(
|
||||
/* sql */ `create index idx_tmgrp_tournament_team_id on "TournamentMatchGameResultParticipant"("tournamentTeamId")`,
|
||||
).run();
|
||||
})();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user