show rank in highscore view
This commit is contained in:
parent
0ed0928a7b
commit
d20993e6aa
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user