show rank in highscore view
All checks were successful
CI/CD Pipeline / test (push) Successful in 4m16s
CI/CD Pipeline / deploy (push) Successful in 2m55s

This commit is contained in:
Philipp Hofer 2025-04-14 15:40:28 +02:00
parent 0ed0928a7b
commit d20993e6aa

View File

@ -36,12 +36,17 @@ async fn highscore(State(db): State<Arc<SqlitePool>>, session: Session) -> Marku
} }
} }
td { "Gesamtpunkte" } td { "Gesamtpunkte" }
td { "Rang" }
td { "Team" } td { "Team" }
} }
} }
tbody { tbody {
@let mut rank = 0;
@let mut amount_teams_iterated = 0;
@let mut prev_points = i64::MAX;
@for team in route.teams_ordered_by_points(&db).await { @for team in route.teams_ordered_by_points(&db).await {
@let mut total_points = 0; @let mut total_points = 0;
({ amount_teams_iterated += 1;"" })
tr { tr {
td { td {
a href=(format!("/admin/team/{}", team.id)) { a href=(format!("/admin/team/{}", team.id)) {
@ -66,6 +71,14 @@ async fn highscore(State(db): State<Arc<SqlitePool>>, session: Session) -> Marku
} }
} }
td { (total_points) } td { (total_points) }
td {
@if total_points < prev_points {
({rank = amount_teams_iterated; ""})
({ prev_points = total_points;"" })
}
(rank)
"."
}
td { td {
a href=(format!("/admin/team/{}", team.id)) { a href=(format!("/admin/team/{}", team.id)) {
(team.name) (team.name)