fix large table overview; Fixes #30
All checks were successful
CI/CD Pipeline / test (push) Successful in 4m6s
CI/CD Pipeline / deploy (push) Successful in 2m46s

This commit is contained in:
Philipp Hofer 2025-04-13 21:43:44 +02:00
parent c34f2c1ac4
commit 4cbd5269d6
4 changed files with 115 additions and 103 deletions

View File

@ -23,47 +23,55 @@ async fn highscore(State(db): State<Arc<SqlitePool>>, session: Session) -> Marku
details open[idx==0] {
summary { (route.name) }
table {
thead {
tr {
td { "Team" }
@for station in route.stations(&db).await {
td {
a href=(format!("/admin/station/{}", station.id)){
(station.name)
}
}
}
td { "Gesamtpunkte" }
}
}
tbody {
@for team in route.teams_ordered_by_points(&db).await {
@let mut total_points = 0;
div class="overflow-auto" {
table {
thead {
tr {
td {
a href=(format!("/admin/team/{}", team.id)) {
(team.name)
}
}
td { "Team" }
@for station in route.stations(&db).await {
td {
@if let Some(rating) = Rating::find_by_team_and_station(&db, &team, &station).await {
@if let (Some(notes), Some(points)) = (rating.notes, rating.points) {
({total_points += points;""})
em data-tooltip=(notes) { (points) }
}@else if let Some(points) = rating.points {
({total_points += points;""})
(points)
}@else {
em data-tooltip="Station hat Team noch nicht bewertet" {
"?"
a href=(format!("/admin/station/{}", station.id)){
(station.name)
}
}
}
td { "Gesamtpunkte" }
td { "Team" }
}
}
tbody {
@for team in route.teams_ordered_by_points(&db).await {
@let mut total_points = 0;
tr {
td {
a href=(format!("/admin/team/{}", team.id)) {
(team.name)
}
}
@for station in route.stations(&db).await {
td {
@if let Some(rating) = Rating::find_by_team_and_station(&db, &team, &station).await {
@if let (Some(notes), Some(points)) = (rating.notes, rating.points) {
({total_points += points;""})
em data-tooltip=(notes) { (points) }
}@else if let Some(points) = rating.points {
({total_points += points;""})
(points)
}@else {
em data-tooltip="Station hat Team noch nicht bewertet" {
"?"
}
}
}
}
}
td { (total_points) }
td {
a href=(format!("/admin/team/{}", team.id)) {
(team.name)
}
}
}
td { (total_points) }
}
}
}

View File

@ -147,9 +147,10 @@ DROP TABLE temp_pos;",
}
async fn stations_not_in_route(&self, db: &SqlitePool) -> Vec<Station> {
// TODO: switch to macro
sqlx::query_as::<_, Station>(
"
SELECT id, name, notes, amount_people, last_login, pw, lat, lng
SELECT id, name, notes, amount_people, last_login, pw, lat, lng, ready
FROM station
WHERE id NOT IN (
SELECT station_id

View File

@ -175,57 +175,59 @@ async fn view(
@if !ratings.is_empty() {
h2 { "Bewertungen" }
table {
thead {
tr {
th { "Team" }
th { "Punkte" }
th { "Notizen" }
th {
em data-tooltip="Angekommen" {
"👋"
div class="overflow-auto" {
table {
thead {
tr {
th { "Team" }
th { "Punkte" }
th { "Notizen" }
th {
em data-tooltip="Angekommen" {
"👋"
}
}
}
th {
em data-tooltip="Begonnen" {
"🎬"
th {
em data-tooltip="Begonnen" {
"🎬"
}
}
}
th {
em data-tooltip="Gegangen" {
"🚶‍♂️"
th {
em data-tooltip="Gegangen" {
"🚶‍♂️"
}
}
}
}
}
tbody {
@for rating in ratings {
tr {
td {
a href=(format!("/admin/team/{}", rating.team_id)) {
(rating.team(&db).await.name)
tbody {
@for rating in ratings {
tr {
td {
a href=(format!("/admin/team/{}", rating.team_id)) {
(rating.team(&db).await.name)
}
}
}
td {
@if let Some(points) = rating.points {
(points)
td {
@if let Some(points) = rating.points {
(points)
}
}
}
td {
@if let Some(ref notes) = rating.notes{
(notes)
td {
@if let Some(ref notes) = rating.notes{
(notes)
}
}
td {
(rating.local_time_arrived_at())
}
td {
(rating.local_time_doing())
}
td {
(rating.local_time_left())
}
}
td {
(rating.local_time_arrived_at())
}
td {
(rating.local_time_doing())
}
td {
(rating.local_time_left())
}
}
}
}
}

View File

@ -1,18 +1,17 @@
use super::{CreateError, LastContactTeam, Team};
use crate::{
AppState,
admin::{route::Route, station::Station},
err,
partials::page,
pl, succ,
pl, succ, AppState,
};
use axum::{
Form, Router,
extract::State,
response::{IntoResponse, Redirect},
routing::{get, post},
Form, Router,
};
use maud::{Markup, PreEscaped, html};
use maud::{html, Markup, PreEscaped};
use serde::Deserialize;
use sqlx::SqlitePool;
use std::sync::Arc;
@ -462,32 +461,34 @@ async fn lost(State(db): State<Arc<SqlitePool>>, session: Session) -> Markup {
a href="/admin/team" { "↩️" }
"Teams: Letzter Kontakt"
}
table {
thead {
tr {
td { "Gruppe" }
td { "Uhrzeit" }
td { "Station" }
}
}
tbody {
@for lost in &losts {
div class="overflow-auto" {
table {
thead {
tr {
td {
a href=(format!("/admin/team/{}", lost.team_id)) {
(lost.team_name)
td { "Gruppe" }
td { "Uhrzeit" }
td { "Station" }
}
}
tbody {
@for lost in &losts {
tr {
td {
a href=(format!("/admin/team/{}", lost.team_id)) {
(lost.team_name)
}
}
}
td {
@if let Some(time) = lost.local_last_contact() {
(time)
}@else{
"No contact yet"
td {
@if let Some(time) = lost.local_last_contact() {
(time)
}@else{
"No contact yet"
}
}
}
td {
a href=(format!("/admin/station/{}", lost.station_id)) {
(lost.station_name)
td {
a href=(format!("/admin/station/{}", lost.station_id)) {
(lost.station_name)
}
}
}
}