Update daily summaries to show unified ELO change instead of separate singles/doubles

This commit is contained in:
Split 2026-02-26 12:24:48 -05:00
parent 539c1c9d08
commit 1116e36a00
3 changed files with 23 additions and 31 deletions

View File

@ -1016,3 +1016,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

Binary file not shown.

View File

@ -2273,21 +2273,15 @@ async fn daily_summary_handler(
.unwrap_or_default();
let mut players_html = String::new();
for (name, email, singles_change, doubles_change) in &player_rating_changes {
let format_change = |c: f64| {
if c > 0.0 { format!("<span style='color:#28a745;'>+{:.0}</span>", c) }
else if c < 0.0 { format!("<span style='color:#dc3545;'>{:.0}</span>", c) }
else { "".to_string() }
};
for (name, _email, singles_change, doubles_change) in &player_rating_changes {
let total = singles_change + doubles_change;
let total_str = if total > 0.0 { format!("<span style='color:#28a745;font-weight:bold;'>+{:.0}</span>", total) }
else if total < 0.0 { format!("<span style='color:#dc3545;font-weight:bold;'>{:.0}</span>", total) }
else { "".to_string() };
let has_email = if !email.is_empty() { "" } else { "" };
players_html.push_str(&format!(
"<tr><td>{}</td><td>{}</td><td style='text-align:center;'>{}</td><td style='text-align:center;'>{}</td><td style='text-align:center;'>{}</td></tr>",
name, has_email, format_change(*singles_change), format_change(*doubles_change), total_str
"<tr><td>{}</td><td style='text-align:center;'>{}</td></tr>",
name, total_str
));
}
@ -2564,10 +2558,7 @@ async fn daily_summary_handler(
<thead>
<tr>
<th>Player</th>
<th>Email</th>
<th>Singles Δ</th>
<th>Doubles Δ</th>
<th>Total</th>
<th>ELO Δ</th>
</tr>
</thead>
<tbody>
@ -2738,19 +2729,14 @@ async fn send_daily_summary(
let mut players_email_html = String::new();
for (name, singles_change, doubles_change) in &player_rating_changes {
let format_change = |c: f64| {
if c > 0.0 { format!("<span style='color:#28a745;'>+{:.0}</span>", c) }
else if c < 0.0 { format!("<span style='color:#dc3545;'>{:.0}</span>", c) }
else { "".to_string() }
};
let total = singles_change + doubles_change;
let total_str = if total > 0.0 { format!("<span style='color:#28a745;font-weight:bold;'>+{:.0}</span>", total) }
else if total < 0.0 { format!("<span style='color:#dc3545;font-weight:bold;'>{:.0}</span>", total) }
else { "".to_string() };
players_email_html.push_str(&format!(
"<tr><td>{}</td><td style='text-align:center;'>{}</td><td style='text-align:center;'>{}</td><td style='text-align:center;'>{}</td></tr>",
name, format_change(*singles_change), format_change(*doubles_change), total_str
"<tr><td>{}</td><td style='text-align:center;'>{}</td></tr>",
name, total_str
));
}
@ -2982,9 +2968,7 @@ async fn send_daily_summary(
<table style="width: 100%; border-collapse: collapse;">
<tr style="background: #003594; color: white;">
<th style="padding: 8px; text-align: left;">Player</th>
<th style="padding: 8px; text-align: center;">Singles Δ</th>
<th style="padding: 8px; text-align: center;">Doubles Δ</th>
<th style="padding: 8px; text-align: center;">Total</th>
<th style="padding: 8px; text-align: center;">ELO Δ</th>
</tr>
{}
</table>
@ -3136,19 +3120,14 @@ async fn daily_public_handler(
let mut players_html = String::new();
for (name, singles_change, doubles_change) in &player_rating_changes {
let format_change = |c: f64| {
if c > 0.0 { format!("<span style='color:#28a745;'>+{:.0}</span>", c) }
else if c < 0.0 { format!("<span style='color:#dc3545;'>{:.0}</span>", c) }
else { "".to_string() }
};
let total = singles_change + doubles_change;
let total_str = if total > 0.0 { format!("<span style='color:#28a745;font-weight:bold;'>+{:.0}</span>", total) }
else if total < 0.0 { format!("<span style='color:#dc3545;font-weight:bold;'>{:.0}</span>", total) }
else { "".to_string() };
players_html.push_str(&format!(
"<tr><td>{}</td><td style='text-align:center;'>{}</td><td style='text-align:center;'>{}</td><td style='text-align:center;'>{}</td></tr>",
name, format_change(*singles_change), format_change(*doubles_change), total_str
"<tr><td>{}</td><td style='text-align:center;'>{}</td></tr>",
name, total_str
));
}
@ -3436,7 +3415,7 @@ async fn daily_public_handler(
<h2>📈 Player Performance</h2>
<table>
<thead>
<tr><th>Player</th><th>Singles Δ</th><th>Doubles Δ</th><th>Total</th></tr>
<tr><th>Player</th><th>ELO Δ</th></tr>
</thead>
<tbody>{}</tbody>
</table>