fix: Improve legacy rank detection logic and add debugging
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user