Complete unified ELO migration: home page explanation, single leaderboards, edit form
This commit is contained in:
parent
1116e36a00
commit
e6cc881a36
@ -1029,3 +1029,16 @@ 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
|
||||
|
||||
|
||||
BIN
pickleball-elo
BIN
pickleball-elo
Binary file not shown.
82
src/main.rs
82
src/main.rs
@ -285,9 +285,9 @@ async fn index_handler(State(state): State<AppState>) -> Html<String> {
|
||||
<style>{}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" style="max-width: 600px; text-align: center;">
|
||||
<div class="container" style="max-width: 700px; text-align: center;">
|
||||
<h1>🏓 Pickleball ELO Tracker</h1>
|
||||
<p style="color: #666;">Glicko-2 Rating System v3.0</p>
|
||||
<p style="color: #666;">Pure ELO Rating System v3.0</p>
|
||||
|
||||
<div class="stats-grid">
|
||||
<div class="stat-card">
|
||||
@ -305,6 +305,30 @@ async fn index_handler(State(state): State<AppState>) -> Html<String> {
|
||||
</div>
|
||||
|
||||
{}
|
||||
|
||||
<div style="margin-top: 40px; text-align: left; background: #f9f9f9; padding: 25px; border-radius: 12px;">
|
||||
<h2 style="color: #003594; margin-top: 0;">📊 How Ratings Work</h2>
|
||||
|
||||
<p><strong>One unified rating</strong> — Singles and doubles matches both contribute to a single ELO rating. Everyone starts at 1500.</p>
|
||||
|
||||
<p><strong>Per-point scoring</strong> — Your rating change depends on your actual point performance (points won ÷ total points), not just whether you won or lost. Winning 11-2 earns more than winning 11-9.</p>
|
||||
|
||||
<p><strong>Smart doubles scoring</strong> — In doubles, we calculate your "effective opponent" using:<br>
|
||||
<code style="background: #e9e9e9; padding: 2px 6px; border-radius: 4px;">Effective Opponent = Opp1 + Opp2 - Teammate</code></p>
|
||||
|
||||
<p>This means:</p>
|
||||
<ul style="margin-left: 20px;">
|
||||
<li><strong>Strong teammate</strong> → lower effective opponent → less credit for winning</li>
|
||||
<li><strong>Weak teammate</strong> → higher effective opponent → more credit for winning</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>The formula:</strong><br>
|
||||
<code style="background: #e9e9e9; padding: 4px 8px; border-radius: 4px; display: inline-block; margin-top: 5px;">
|
||||
Rating Change = 32 × (Actual Performance - Expected Performance)
|
||||
</code></p>
|
||||
|
||||
<p style="color: #666; font-size: 13px; margin-bottom: 0;">Fair, transparent, and no mysterious "volatility" numbers. Just skill vs. expectations.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -983,7 +1007,7 @@ async fn new_player_form() -> Html<String> {
|
||||
///
|
||||
/// **Endpoint:** `POST /players/new`
|
||||
///
|
||||
/// **Description:** Processes form submission to add a new player. Initializes with default Glicko-2 ratings (1500) and RD (350).
|
||||
/// **Description:** Processes form submission to add a new player. Initializes with default ELO ratings (1500) and RD (350).
|
||||
///
|
||||
/// **Form Fields:**
|
||||
/// - `name` (required): Player name
|
||||
@ -1065,17 +1089,12 @@ async fn edit_player_form(
|
||||
style="width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; box-sizing: border-box;">
|
||||
</div>
|
||||
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;">
|
||||
<div>
|
||||
<label style="display: block; font-weight: bold; margin-bottom: 8px;">Singles Rating</label>
|
||||
<input type="number" name="singles_rating" step="0.1" value="{:.1}"
|
||||
style="width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; box-sizing: border-box;">
|
||||
</div>
|
||||
<div>
|
||||
<label style="display: block; font-weight: bold; margin-bottom: 8px;">Doubles Rating</label>
|
||||
<input type="number" name="doubles_rating" step="0.1" value="{:.1}"
|
||||
style="width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; box-sizing: border-box;">
|
||||
</div>
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label style="display: block; font-weight: bold; margin-bottom: 8px;">ELO Rating</label>
|
||||
<input type="number" name="singles_rating" step="0.1" value="{:.1}"
|
||||
style="width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; box-sizing: border-box;">
|
||||
<input type="hidden" name="doubles_rating" value="{:.1}">
|
||||
<p style="color: #666; font-size: 12px; margin-top: 5px;">Unified rating for all match types</p>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success" style="width: 100%; padding: 14px;">Save Changes</button>
|
||||
@ -1254,7 +1273,7 @@ async fn new_match_form(State(state): State<AppState>) -> Html<String> {
|
||||
Html(html)
|
||||
}
|
||||
|
||||
/// Records a new match result and updates all participants' ratings using Glicko-2
|
||||
/// Records a new match result and updates all participants' ratings using ELO
|
||||
///
|
||||
/// **Endpoint:** `POST /matches/new`
|
||||
///
|
||||
@ -1976,15 +1995,9 @@ async fn session_preview_handler(
|
||||
<h4>🎾 Match Results</h4>
|
||||
{}
|
||||
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px;">
|
||||
<div>
|
||||
<h4>📊 Top Singles</h4>
|
||||
{}
|
||||
</div>
|
||||
<div>
|
||||
<h4>📊 Top Doubles</h4>
|
||||
{}
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<h4>📊 Top Players (Unified ELO)</h4>
|
||||
{}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1996,7 +2009,7 @@ async fn session_preview_handler(
|
||||
</html>
|
||||
"#, id, COMMON_CSS, id, nav_html(), already_sent, match_count, recipients.len(),
|
||||
recipients_list, matches_html, &start_time[..16], end_time.as_deref().unwrap_or("In Progress"),
|
||||
matches_html, singles_list, doubles_list, send_button);
|
||||
matches_html, singles_list, send_button);
|
||||
|
||||
Ok(Html(html))
|
||||
}
|
||||
@ -2124,19 +2137,16 @@ async fn send_session_email(
|
||||
<h2 style="color: #333; border-bottom: 2px solid #003594; padding-bottom: 10px;">🎾 Match Results</h2>
|
||||
{}
|
||||
|
||||
<h2 style="color: #333; border-bottom: 2px solid #003594; padding-bottom: 10px; margin-top: 30px;">📊 Top Singles</h2>
|
||||
<table style="width: 100%;">{}</table>
|
||||
|
||||
<h2 style="color: #333; border-bottom: 2px solid #003594; padding-bottom: 10px; margin-top: 30px;">📊 Top Doubles</h2>
|
||||
<h2 style="color: #333; border-bottom: 2px solid #003594; padding-bottom: 10px; margin-top: 30px;">📊 Top Players (Unified ELO)</h2>
|
||||
<table style="width: 100%;">{}</table>
|
||||
|
||||
<p style="text-align: center; margin-top: 30px; color: #666; font-size: 12px;">
|
||||
Pickleball ELO Tracker - Glicko-2 Rating System
|
||||
Pickleball ELO Tracker - Pure ELO Rating System
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"#, matches_email_html, singles_html, doubles_html);
|
||||
"#, matches_email_html, singles_html);
|
||||
|
||||
// Send emails using lettre (already in dependencies)
|
||||
use lettre::{Message, SmtpTransport, Transport};
|
||||
@ -2616,11 +2626,7 @@ async fn daily_summary_handler(
|
||||
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px;">
|
||||
<div>
|
||||
<h4 style="border-bottom: 2px solid #FFB81C; padding-bottom: 5px;">📊 Top Singles</h4>
|
||||
{}
|
||||
</div>
|
||||
<div>
|
||||
<h4 style="border-bottom: 2px solid #FFB81C; padding-bottom: 5px;">📊 Top Doubles</h4>
|
||||
<h4 style="border-bottom: 2px solid #FFB81C; padding-bottom: 5px;">📊 Top Players (Unified ELO)</h4>
|
||||
{}
|
||||
</div>
|
||||
</div>
|
||||
@ -2631,7 +2637,7 @@ async fn daily_summary_handler(
|
||||
</body>
|
||||
</html>
|
||||
"#, COMMON_CSS, nav_html(), target_date, matches.len(), recipients.len(),
|
||||
matches_html, players_html, singles_labels, singles_datasets, doubles_labels, doubles_datasets, heatmap_html, recipients_html, target_date, matches_html, singles_list, doubles_list, send_button);
|
||||
matches_html, players_html, singles_labels, singles_datasets, doubles_labels, doubles_datasets, heatmap_html, recipients_html, target_date, matches_html, singles_list, send_button);
|
||||
|
||||
Html(html)
|
||||
}
|
||||
@ -3475,7 +3481,7 @@ async fn daily_public_handler(
|
||||
{}
|
||||
|
||||
<div class="footer">
|
||||
Pickleball ELO Tracker · Glicko-2 Rating System · Hail to Pitt! 🐆
|
||||
Pickleball ELO Tracker · ELO Rating System · Hail to Pitt! 🐆
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user