Update player list and profile pages to show unified ELO rating
This commit is contained in:
parent
39ece00b36
commit
539c1c9d08
@ -951,3 +951,68 @@ Starting Pickleball ELO Tracker Server on port 3000...
|
||||
➕ 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
|
||||
|
||||
🏓 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
|
||||
|
||||
|
||||
BIN
pickleball-elo
BIN
pickleball-elo
Binary file not shown.
24
src/main.rs
24
src/main.rs
@ -540,8 +540,8 @@ async fn player_profile_handler(
|
||||
if wins >= 1 { achievements.push("✨ First Win"); }
|
||||
if wins >= 10 { achievements.push("🔥 10 Wins"); }
|
||||
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 >= 1900.0 || doubles_rating >= 1900.0 { achievements.push("👑 Elite (1900+)"); }
|
||||
if singles_rating >= 1700.0 { achievements.push("⭐ Rising Star (1700+)"); }
|
||||
if singles_rating >= 1900.0 { achievements.push("👑 Elite (1900+)"); }
|
||||
|
||||
let achievements_html: String = achievements.iter()
|
||||
.map(|a| format!(r#"<span class="achievement">{}</span>"#, a))
|
||||
@ -649,11 +649,7 @@ async fn player_profile_handler(
|
||||
<div class="stats-grid">
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">{:.0}</div>
|
||||
<div class="stat-label">Singles Rating</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">{:.0}</div>
|
||||
<div class="stat-label">Doubles Rating</div>
|
||||
<div class="stat-label">ELO Rating</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">{}</div>
|
||||
@ -727,7 +723,7 @@ async fn player_profile_handler(
|
||||
</html>
|
||||
"#, name, COMMON_CSS, nav_html(), name,
|
||||
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);
|
||||
|
||||
Ok(Html(html))
|
||||
@ -1518,20 +1514,20 @@ async fn create_match(
|
||||
///
|
||||
/// **Returns:** HTML page with players table
|
||||
async fn players_list_handler(State(state): State<AppState>) -> Html<String> {
|
||||
let players: Vec<(i64, String, Option<String>, f64, f64)> = sqlx::query_as(
|
||||
"SELECT id, name, email, singles_rating, doubles_rating FROM players ORDER BY name"
|
||||
// UNIFIED RATING: just get singles_rating as the unified rating
|
||||
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)
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
|
||||
let player_rows: String = players.iter()
|
||||
.map(|(id, name, _email, sr, dr)| {
|
||||
.map(|(id, name, _email, rating)| {
|
||||
format!(r#"<tr>
|
||||
<td><a href="/players/{}">{}</a></td>
|
||||
<td>{:.0}</td>
|
||||
<td>{:.0}</td>
|
||||
</tr>"#, id, name, sr, dr)
|
||||
</tr>"#, id, name, rating)
|
||||
})
|
||||
.collect();
|
||||
|
||||
@ -1555,7 +1551,7 @@ async fn players_list_handler(State(state): State<AppState>) -> Html<String> {
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Singles</th><th>Doubles</th></tr>
|
||||
<tr><th>Name</th><th>Rating</th></tr>
|
||||
</thead>
|
||||
<tbody>{}</tbody>
|
||||
</table>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user