Update player list and profile pages to show unified ELO rating

This commit is contained in:
Split 2026-02-26 12:22:17 -05:00
parent 39ece00b36
commit 539c1c9d08
3 changed files with 75 additions and 14 deletions

View File

@ -951,3 +951,68 @@ Starting Pickleball ELO Tracker Server on port 3000...
Add Player: http://localhost:3000/players/new Add Player: http://localhost:3000/players/new
🎾 Record Match: http://localhost:3000/matches/new 🎾 Record Match: http://localhost:3000/matches/new
🏓 Pickleball ELO Tracker v3.0
==============================
Starting Pickleball ELO Tracker Server on port 3000...
✅ Server running at http://localhost:3000
📊 Leaderboard: http://localhost:3000/leaderboard
📜 Match History: http://localhost:3000/matches
👥 Players: http://localhost:3000/players
⚖️ Team Balancer: http://localhost:3000/balance
Add Player: http://localhost:3000/players/new
🎾 Record Match: http://localhost:3000/matches/new
🏓 Pickleball ELO Tracker v3.0
==============================
Starting Pickleball ELO Tracker Server on port 3000...
✅ Server running at http://localhost:3000
📊 Leaderboard: http://localhost:3000/leaderboard
📜 Match History: http://localhost:3000/matches
👥 Players: http://localhost:3000/players
⚖️ Team Balancer: http://localhost:3000/balance
Add Player: http://localhost:3000/players/new
🎾 Record Match: http://localhost:3000/matches/new
🏓 Pickleball ELO Tracker v3.0
==============================
Starting Pickleball ELO Tracker Server on port 3000...
✅ Server running at http://localhost:3000
📊 Leaderboard: http://localhost:3000/leaderboard
📜 Match History: http://localhost:3000/matches
👥 Players: http://localhost:3000/players
⚖️ Team Balancer: http://localhost:3000/balance
Add Player: http://localhost:3000/players/new
🎾 Record Match: http://localhost:3000/matches/new
🏓 Pickleball ELO Tracker v3.0
==============================
Starting Pickleball ELO Tracker Server on port 3000...
✅ Server running at http://localhost:3000
📊 Leaderboard: http://localhost:3000/leaderboard
📜 Match History: http://localhost:3000/matches
👥 Players: http://localhost:3000/players
⚖️ Team Balancer: http://localhost:3000/balance
Add Player: http://localhost:3000/players/new
🎾 Record Match: http://localhost:3000/matches/new
🏓 Pickleball ELO Tracker v3.0
==============================
Starting Pickleball ELO Tracker Server on port 3000...
✅ Server running at http://localhost:3000
📊 Leaderboard: http://localhost:3000/leaderboard
📜 Match History: http://localhost:3000/matches
👥 Players: http://localhost:3000/players
⚖️ Team Balancer: http://localhost:3000/balance
Add Player: http://localhost:3000/players/new
🎾 Record Match: http://localhost:3000/matches/new

Binary file not shown.

View File

@ -540,8 +540,8 @@ async fn player_profile_handler(
if wins >= 1 { achievements.push("✨ First Win"); } if wins >= 1 { achievements.push("✨ First Win"); }
if wins >= 10 { achievements.push("🔥 10 Wins"); } if wins >= 10 { achievements.push("🔥 10 Wins"); }
if win_rate >= 60 && total_matches >= 5 { achievements.push("💪 60% Win Rate"); } if win_rate >= 60 && total_matches >= 5 { achievements.push("💪 60% Win Rate"); }
if singles_rating >= 1700.0 || doubles_rating >= 1700.0 { achievements.push("⭐ Rising Star (1700+)"); } if singles_rating >= 1700.0 { achievements.push("⭐ Rising Star (1700+)"); }
if singles_rating >= 1900.0 || doubles_rating >= 1900.0 { achievements.push("👑 Elite (1900+)"); } if singles_rating >= 1900.0 { achievements.push("👑 Elite (1900+)"); }
let achievements_html: String = achievements.iter() let achievements_html: String = achievements.iter()
.map(|a| format!(r#"<span class="achievement">{}</span>"#, a)) .map(|a| format!(r#"<span class="achievement">{}</span>"#, a))
@ -649,11 +649,7 @@ async fn player_profile_handler(
<div class="stats-grid"> <div class="stats-grid">
<div class="stat-card"> <div class="stat-card">
<div class="stat-value">{:.0}</div> <div class="stat-value">{:.0}</div>
<div class="stat-label">Singles Rating</div> <div class="stat-label">ELO Rating</div>
</div>
<div class="stat-card">
<div class="stat-value">{:.0}</div>
<div class="stat-label">Doubles Rating</div>
</div> </div>
<div class="stat-card"> <div class="stat-card">
<div class="stat-value">{}</div> <div class="stat-value">{}</div>
@ -727,7 +723,7 @@ async fn player_profile_handler(
</html> </html>
"#, name, COMMON_CSS, nav_html(), name, "#, name, COMMON_CSS, nav_html(), name,
email.as_deref().unwrap_or("No email"), player_id, email.as_deref().unwrap_or("No email"), player_id,
singles_rating, doubles_rating, total_matches, wins, losses, win_rate, singles_rating, total_matches, wins, losses, win_rate,
achievements_html, h2h_rows, partners_rows, recent_rows, chart_data, chart_data); achievements_html, h2h_rows, partners_rows, recent_rows, chart_data, chart_data);
Ok(Html(html)) Ok(Html(html))
@ -1518,20 +1514,20 @@ async fn create_match(
/// ///
/// **Returns:** HTML page with players table /// **Returns:** HTML page with players table
async fn players_list_handler(State(state): State<AppState>) -> Html<String> { async fn players_list_handler(State(state): State<AppState>) -> Html<String> {
let players: Vec<(i64, String, Option<String>, f64, f64)> = sqlx::query_as( // UNIFIED RATING: just get singles_rating as the unified rating
"SELECT id, name, email, singles_rating, doubles_rating FROM players ORDER BY name" let players: Vec<(i64, String, Option<String>, f64)> = sqlx::query_as(
"SELECT id, name, email, singles_rating FROM players ORDER BY singles_rating DESC"
) )
.fetch_all(&state.pool) .fetch_all(&state.pool)
.await .await
.unwrap_or_default(); .unwrap_or_default();
let player_rows: String = players.iter() let player_rows: String = players.iter()
.map(|(id, name, _email, sr, dr)| { .map(|(id, name, _email, rating)| {
format!(r#"<tr> format!(r#"<tr>
<td><a href="/players/{}">{}</a></td> <td><a href="/players/{}">{}</a></td>
<td>{:.0}</td> <td>{:.0}</td>
<td>{:.0}</td> </tr>"#, id, name, rating)
</tr>"#, id, name, sr, dr)
}) })
.collect(); .collect();
@ -1555,7 +1551,7 @@ async fn players_list_handler(State(state): State<AppState>) -> Html<String> {
<table> <table>
<thead> <thead>
<tr><th>Name</th><th>Singles</th><th>Doubles</th></tr> <tr><th>Name</th><th>Rating</th></tr>
</thead> </thead>
<tbody>{}</tbody> <tbody>{}</tbody>
</table> </table>