fix large table overview; Fixes #30
This commit is contained in:
parent
c34f2c1ac4
commit
4cbd5269d6
@ -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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user