fix: Correct legacy rank detection - check rating range instead
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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}
|
||||
<!-- Show CS:GO rank icon for legacy matches -->
|
||||
<RankIcon skillGroup={oldRating} {size} class={className} />
|
||||
<!-- Use rating (rank_new) as it contains the current skill group -->
|
||||
<RankIcon skillGroup={rating} {size} class={className} />
|
||||
{:else if !rating || rating === 0}
|
||||
<!-- No rating available -->
|
||||
<span class="text-sm text-base-content/50">Unranked</span>
|
||||
|
||||
Reference in New Issue
Block a user