From 68aada0c3312ba0a67af67e0cb3ee1f283d2bcee Mon Sep 17 00:00:00 2001 From: vikingowl Date: Wed, 12 Nov 2025 23:38:56 +0100 Subject: [PATCH] fix: Correct legacy rank detection - check rating range instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API returns CS:GO skill groups (0-18) in BOTH rank_old and rank_new fields for legacy matches. Updated detection logic to: - Check if rating (rank_new) is in 0-18 range (CS:GO skill groups) - CS2 ratings are typically 1000-30000, so no overlap - Use rating value for RankIcon display (contains current skill group) Debug output showed: - rating: 15-17 (CS:GO skill groups) - oldRating: same values (15-17) - Previous logic failed because rating was not 0 This fix properly detects and displays CS:GO rank icons for legacy matches. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/ui/PremierRatingBadge.svelte | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/components/ui/PremierRatingBadge.svelte b/src/lib/components/ui/PremierRatingBadge.svelte index fbb1b98..4336c84 100644 --- a/src/lib/components/ui/PremierRatingBadge.svelte +++ b/src/lib/components/ui/PremierRatingBadge.svelte @@ -23,14 +23,15 @@ class: className = '' }: Props = $props(); - // Determine if this is a legacy CS:GO match (has old rank but no new rating) - // CS:GO skill groups are 0-18, CS2 ratings are typically > 1000 + // Determine if this is a legacy CS:GO match + // CS:GO skill groups are 0-18, CS2 ratings are typically 1000-30000 + // For legacy matches, both rating and oldRating will be in the 0-18 range const isLegacyRank = $derived( - oldRating !== undefined && - oldRating !== null && - oldRating >= 0 && - oldRating <= 18 && - (!rating || rating === 0 || rating > 30000) + rating !== undefined && + rating !== null && + rating >= 0 && + rating <= 18 && + (oldRating === undefined || oldRating === null || (oldRating >= 0 && oldRating <= 18)) ); // Debug logging (temporary) @@ -68,7 +69,8 @@ {#if isLegacyRank} - + + {:else if !rating || rating === 0} Unranked