use rank 10 million for unranked players

This commit is contained in:
2026-03-09 22:36:20 +01:00
parent 2b2de11c73
commit de1e5a7f21
3 changed files with 27 additions and 10 deletions

View File

@@ -14,8 +14,9 @@ import { proxyImage } from './storage/r2';
let pendingOsuProfile: { rank: number | null } | null = null;
function eloFromRank(rank: number | null): { elo: number; osuRank: number | null } {
if (!rank || rank <= 0) return { elo: 1000, osuRank: null };
const rawElo = 3500 - Math.log10(rank) * 500;
// Unranked → treat as rank 10,000,000 (yields 0 ELO)
const effectiveRank = rank && rank > 0 ? rank : 10_000_000;
const rawElo = 3500 - Math.log10(effectiveRank) * 500;
return { elo: Math.round(Math.max(0, Math.min(3500, rawElo))), osuRank: rank };
}