From 8b1a949ebe1349c13712e558723d9ffe29e38d05 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Mon, 30 Mar 2026 18:06:18 +0300 Subject: [PATCH] Consider tier for recent results --- .../front-page/core/ShowcaseTournaments.server.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/features/front-page/core/ShowcaseTournaments.server.ts b/app/features/front-page/core/ShowcaseTournaments.server.ts index 7893740ae..847ba269d 100644 --- a/app/features/front-page/core/ShowcaseTournaments.server.ts +++ b/app/features/front-page/core/ShowcaseTournaments.server.ts @@ -189,10 +189,10 @@ function deleteExtraResults(tournaments: ShowcaseCalendarEvent[]) { const rankedResults = tournaments .filter((tournament) => tournament.firstPlacer && tournament.isRanked) - .sort((a, b) => b.teamsCount - a.teamsCount); + .sort((a, b) => showcaseScore(b) - showcaseScore(a)); const nonRankedResults = tournaments .filter((tournament) => tournament.firstPlacer && !tournament.isRanked) - .sort((a, b) => b.teamsCount - a.teamsCount); + .sort((a, b) => showcaseScore(b) - showcaseScore(a)); const rankedResultsToKeep = rankedResults.slice(0, 4); // min 2, max 6 non ranked results @@ -383,3 +383,13 @@ function databaseTimestampSixHoursAgo() { return dateToDatabaseTimestamp(now); } + +const TIER_BONUS_PER_STEP = 5; +function showcaseScore(tournament: ShowcaseCalendarEvent): number { + const tierBonus = + typeof tournament.tier === "number" + ? (10 - tournament.tier) * TIER_BONUS_PER_STEP + : 0; + + return tournament.teamsCount + tierBonus; +}