show which teams to take to first station; Fixes #29
All checks were successful
CI/CD Pipeline / test (push) Successful in 4m1s
CI/CD Pipeline / deploy (push) Successful in 2m42s

This commit is contained in:
Philipp Hofer 2025-04-13 21:34:52 +02:00
parent 2a1d0a7616
commit c34f2c1ac4
4 changed files with 35 additions and 4 deletions

View File

@ -2,3 +2,4 @@
## Marketing ## Marketing
- single-binary (+ db + .env) - single-binary (+ db + .env)
- Teams werden automatisch (start)stationen zugewiesen

View File

@ -130,9 +130,10 @@ DROP TABLE temp_pos;",
} }
pub(crate) async fn stations(&self, db: &SqlitePool) -> Vec<Station> { pub(crate) async fn stations(&self, db: &SqlitePool) -> Vec<Station> {
// TODO: switch to macro
sqlx::query_as::<_, Station>( sqlx::query_as::<_, Station>(
" "
SELECT s.id, s.name, s.notes, s.amount_people, s.last_login, s.pw, s.lat, s.lng SELECT s.id, s.name, s.notes, s.amount_people, s.last_login, s.pw, s.lat, s.lng, s.ready
FROM station s FROM station s
JOIN route_station rs ON s.id = rs.station_id JOIN route_station rs ON s.id = rs.station_id
WHERE rs.route_id = ? WHERE rs.route_id = ?

View File

@ -13,8 +13,8 @@ mod web;
pub(crate) struct Team { pub(crate) struct Team {
pub(crate) id: i64, pub(crate) id: i64,
pub(crate) name: String, pub(crate) name: String,
notes: Option<String>, pub(crate) notes: Option<String>,
amount_people: Option<i64>, pub(crate) amount_people: Option<i64>,
first_station_id: i64, first_station_id: i64,
route_id: i64, route_id: i64,
} }

View File

@ -40,7 +40,36 @@ async fn view(
@if let (Some(lat), Some(lng)) = (station.lat, station.lng) { @if let (Some(lat), Some(lng)) = (station.lat, station.lng) {
article { article {
details open[(!station.ready)]{ details open[(!station.ready)]{
summary { "Stationsort" } summary { "Infos" }
@let first_teams = Team::all_with_first_station(&db, &station).await;
@if first_teams.is_empty() {
"Du musst keine Teams zu deiner Station mitnehmen"
} @else{
b { (format!("Nimm bitte folgende {} Teams am Anfang zu deiner Station mit:", first_teams.len())) }
ol {
@for team in first_teams {
li {
b {
(team.name)
}
ul {
@if let Some(amount_people) = team.amount_people {
li {
(amount_people)
" Personen"
}
}
@if let Some(notes) = team.notes {
li {
(notes)
}
}
}
}
}
}
}
b { "Hier befindet sich deine Station:" } b { "Hier befindet sich deine Station:" }
div id="map" style="height: 500px" {} div id="map" style="height: 500px" {}
script { (format!(" script { (format!("