From f8cf85661e74c0b9a1f4ecf253793c5c5b9717e7 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Wed, 12 Nov 2025 23:36:49 +0100 Subject: [PATCH] fix: Improve legacy rank detection logic and add debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update isLegacyRank check to properly detect CS:GO skill groups (0-18) - Handle edge case where oldRating could be 0 (unranked) - Add temporary debug logging to trace rank data values - Fix detection for matches where rating is outside CS2 range This will help identify if rank data is being passed correctly from the API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/ui/PremierRatingBadge.svelte | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/lib/components/ui/PremierRatingBadge.svelte b/src/lib/components/ui/PremierRatingBadge.svelte index 31cb50e..fbb1b98 100644 --- a/src/lib/components/ui/PremierRatingBadge.svelte +++ b/src/lib/components/ui/PremierRatingBadge.svelte @@ -24,10 +24,26 @@ }: 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 const isLegacyRank = $derived( - (!rating || rating === 0) && oldRating !== undefined && oldRating !== null && oldRating > 0 + oldRating !== undefined && + oldRating !== null && + oldRating >= 0 && + oldRating <= 18 && + (!rating || rating === 0 || rating > 30000) ); + // Debug logging (temporary) + $effect(() => { + if (oldRating !== undefined || rating !== undefined) { + console.log('[PremierRatingBadge]', { + oldRating, + rating, + isLegacyRank + }); + } + }); + const tierInfo = $derived(formatPremierRating(rating)); const changeInfo = $derived(showChange ? getPremierRatingChange(oldRating, rating) : null);