Prefer matches with a winner for home page featured battle
Filter the match pool to those with winner_id set before selecting the featured replay, so a stalemate is never shown as the hero replay. Falls back to any completed match if no decided matches exist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
250140d0f7
commit
74ab553925
1 changed files with 5 additions and 1 deletions
|
|
@ -22,7 +22,11 @@ async function findFeaturedReplay(
|
|||
);
|
||||
if (completed.length === 0) return { match: null, enriched: false };
|
||||
|
||||
const sorted = [...completed].sort(
|
||||
// Prefer matches with a winner (no stalemates on the home page)
|
||||
const withWinner = completed.filter((m) => !!m.winner_id);
|
||||
const pool = withWinner.length > 0 ? withWinner : completed;
|
||||
|
||||
const sorted = [...pool].sort(
|
||||
(a, b) =>
|
||||
new Date(b.completed_at!).getTime() -
|
||||
new Date(a.completed_at!).getTime(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue