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] {
|
details open[idx==0] {
|
||||||
summary { (route.name) }
|
summary { (route.name) }
|
||||||
|
|
||||||
table {
|
div class="overflow-auto" {
|
||||||
thead {
|
table {
|
||||||
tr {
|
thead {
|
||||||
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;
|
|
||||||
tr {
|
tr {
|
||||||
td {
|
td { "Team" }
|
||||||
a href=(format!("/admin/team/{}", team.id)) {
|
|
||||||
(team.name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@for station in route.stations(&db).await {
|
@for station in route.stations(&db).await {
|
||||||
td {
|
td {
|
||||||
@if let Some(rating) = Rating::find_by_team_and_station(&db, &team, &station).await {
|
a href=(format!("/admin/station/{}", station.id)){
|
||||||
@if let (Some(notes), Some(points)) = (rating.notes, rating.points) {
|
(station.name)
|
||||||
({total_points += points;""})
|
}
|
||||||
em data-tooltip=(notes) { (points) }
|
}
|
||||||
}@else if let Some(points) = rating.points {
|
}
|
||||||
({total_points += points;""})
|
td { "Gesamtpunkte" }
|
||||||
(points)
|
td { "Team" }
|
||||||
}@else {
|
}
|
||||||
em data-tooltip="Station hat Team noch nicht bewertet" {
|
}
|
||||||
"?"
|
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> {
|
async fn stations_not_in_route(&self, db: &SqlitePool) -> Vec<Station> {
|
||||||
|
// TODO: switch to macro
|
||||||
sqlx::query_as::<_, Station>(
|
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
|
FROM station
|
||||||
WHERE id NOT IN (
|
WHERE id NOT IN (
|
||||||
SELECT station_id
|
SELECT station_id
|
||||||
|
@ -175,57 +175,59 @@ async fn view(
|
|||||||
|
|
||||||
@if !ratings.is_empty() {
|
@if !ratings.is_empty() {
|
||||||
h2 { "Bewertungen" }
|
h2 { "Bewertungen" }
|
||||||
table {
|
div class="overflow-auto" {
|
||||||
thead {
|
table {
|
||||||
tr {
|
thead {
|
||||||
th { "Team" }
|
tr {
|
||||||
th { "Punkte" }
|
th { "Team" }
|
||||||
th { "Notizen" }
|
th { "Punkte" }
|
||||||
th {
|
th { "Notizen" }
|
||||||
em data-tooltip="Angekommen" {
|
th {
|
||||||
"👋"
|
em data-tooltip="Angekommen" {
|
||||||
|
"👋"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
th {
|
||||||
th {
|
em data-tooltip="Begonnen" {
|
||||||
em data-tooltip="Begonnen" {
|
"🎬"
|
||||||
"🎬"
|
}
|
||||||
}
|
}
|
||||||
}
|
th {
|
||||||
th {
|
em data-tooltip="Gegangen" {
|
||||||
em data-tooltip="Gegangen" {
|
"🚶♂️"
|
||||||
"🚶♂️"
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
tbody {
|
||||||
tbody {
|
@for rating in ratings {
|
||||||
@for rating in ratings {
|
tr {
|
||||||
tr {
|
td {
|
||||||
td {
|
a href=(format!("/admin/team/{}", rating.team_id)) {
|
||||||
a href=(format!("/admin/team/{}", rating.team_id)) {
|
(rating.team(&db).await.name)
|
||||||
(rating.team(&db).await.name)
|
}
|
||||||
}
|
}
|
||||||
}
|
td {
|
||||||
td {
|
@if let Some(points) = rating.points {
|
||||||
@if let Some(points) = rating.points {
|
(points)
|
||||||
(points)
|
}
|
||||||
}
|
}
|
||||||
}
|
td {
|
||||||
td {
|
@if let Some(ref notes) = rating.notes{
|
||||||
@if let Some(ref notes) = rating.notes{
|
(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 super::{CreateError, LastContactTeam, Team};
|
||||||
use crate::{
|
use crate::{
|
||||||
AppState,
|
|
||||||
admin::{route::Route, station::Station},
|
admin::{route::Route, station::Station},
|
||||||
err,
|
err,
|
||||||
partials::page,
|
partials::page,
|
||||||
pl, succ,
|
pl, succ, AppState,
|
||||||
};
|
};
|
||||||
use axum::{
|
use axum::{
|
||||||
Form, Router,
|
|
||||||
extract::State,
|
extract::State,
|
||||||
response::{IntoResponse, Redirect},
|
response::{IntoResponse, Redirect},
|
||||||
routing::{get, post},
|
routing::{get, post},
|
||||||
|
Form, Router,
|
||||||
};
|
};
|
||||||
use maud::{Markup, PreEscaped, html};
|
use maud::{html, Markup, PreEscaped};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -462,32 +461,34 @@ async fn lost(State(db): State<Arc<SqlitePool>>, session: Session) -> Markup {
|
|||||||
a href="/admin/team" { "↩️" }
|
a href="/admin/team" { "↩️" }
|
||||||
"Teams: Letzter Kontakt"
|
"Teams: Letzter Kontakt"
|
||||||
}
|
}
|
||||||
table {
|
div class="overflow-auto" {
|
||||||
thead {
|
table {
|
||||||
tr {
|
thead {
|
||||||
td { "Gruppe" }
|
|
||||||
td { "Uhrzeit" }
|
|
||||||
td { "Station" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tbody {
|
|
||||||
@for lost in &losts {
|
|
||||||
tr {
|
tr {
|
||||||
td {
|
td { "Gruppe" }
|
||||||
a href=(format!("/admin/team/{}", lost.team_id)) {
|
td { "Uhrzeit" }
|
||||||
(lost.team_name)
|
td { "Station" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tbody {
|
||||||
|
@for lost in &losts {
|
||||||
|
tr {
|
||||||
|
td {
|
||||||
|
a href=(format!("/admin/team/{}", lost.team_id)) {
|
||||||
|
(lost.team_name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
td {
|
||||||
td {
|
@if let Some(time) = lost.local_last_contact() {
|
||||||
@if let Some(time) = lost.local_last_contact() {
|
(time)
|
||||||
(time)
|
}@else{
|
||||||
}@else{
|
"No contact yet"
|
||||||
"No contact yet"
|
}
|
||||||
}
|
}
|
||||||
}
|
td {
|
||||||
td {
|
a href=(format!("/admin/station/{}", lost.station_id)) {
|
||||||
a href=(format!("/admin/station/{}", lost.station_id)) {
|
(lost.station_name)
|
||||||
(lost.station_name)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user