Compare commits

...

2 Commits

Author SHA1 Message Date
3a7cc0e3be don't crash on routes with just 1 station when ending the run
All checks were successful
CI/CD Pipeline / test (push) Successful in 23m47s
CI/CD Pipeline / deploy (push) Successful in 29m1s
2025-05-06 08:34:22 +02:00
3b9c76417d remove completed todos 2025-04-25 10:00:47 +02:00
4 changed files with 10 additions and 10 deletions

View File

@@ -253,6 +253,10 @@ DROP TABLE temp_pos;",
return None;
}
if self.stations(db).await.len() <= 1 {
return None;
}
let ret = sqlx::query_as::<_, Station>(
"
WITH RECURSIVE find_previous AS (
@@ -296,8 +300,6 @@ LIMIT 1;
.bind(self.id)
.bind(self.id)
.bind(self.id)
.bind(self.id)
.bind(station.id)
.fetch_optional(db)
.await
.unwrap();

View File

@@ -15,13 +15,13 @@ pub(crate) mod print;
mod typst;
mod web;
#[derive(FromRow, Debug, Serialize, Deserialize)]
#[derive(FromRow, Debug, Serialize, Deserialize, Clone)]
pub(crate) struct Station {
pub(crate) id: i64,
pub(crate) name: String,
notes: Option<String>,
pub(crate) amount_people: Option<i64>,
last_login: Option<NaiveDateTime>, // TODO use proper timestamp (NaiveDateTime?)
last_login: Option<NaiveDateTime>,
pub(crate) pw: String,
pub(crate) ready: bool,
pub(crate) lat: Option<f64>,

View File

@@ -312,7 +312,7 @@ impl Team {
.await
.next_station(db, &station)
.await
.unwrap();
.unwrap_or(station.clone());
if Rating::find_by_team_and_station(db, self, &next_station)
.await
.is_some()

View File

@@ -1,13 +1,13 @@
use crate::{AppState, er, page, suc};
use crate::{er, page, suc, AppState};
use async_trait::async_trait;
use axum::{
Form, Router,
http::StatusCode,
response::{IntoResponse, Redirect},
routing::{get, post},
Form, Router,
};
use axum_login::{AuthUser, AuthnBackend};
use maud::{Markup, html};
use maud::{html, Markup};
use password_auth::verify_password;
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, SqlitePool};
@@ -119,8 +119,6 @@ async fn login(session: Session) -> Markup {
}
};
// TODO: generate okayish looking login page
page(content, session, false).await
}