fix error where joining cox to planned_event is not dispaying properly. The problem was the restructuring commit https://git.hofer.link/Ruderverein-Donau-Linz/rowt/commit/7569798b008edfbf4763e4134c9a79300b5d66c0#diff-0496fd5ec13efcfc97602dc5784170a0dd1… #101

Merged
philipp merged 1 commits from fix-cox-join into main 2023-12-28 18:15:10 +01:00
4 changed files with 4 additions and 4 deletions
Showing only changes of commit a9fbb05944 - Show all commits

View File

@ -22,7 +22,7 @@ pub mod triptype;
pub mod user; pub mod user;
pub mod usertrip; pub mod usertrip;
#[derive(Serialize)] #[derive(Serialize, Debug)]
pub struct Day { pub struct Day {
day: NaiveDate, day: NaiveDate,
planned_events: Vec<PlannedEventWithUserAndTriptype>, planned_events: Vec<PlannedEventWithUserAndTriptype>,

View File

@ -144,7 +144,7 @@ WHERE day=?",
let mut ret = Vec::new(); let mut ret = Vec::new();
for event in events { for event in events {
let cox = Registration::all_cox(db, event.trip_details_id).await; let cox = Registration::all_cox(db, event.id).await;
let mut trip_type = None; let mut trip_type = None;
if let Some(trip_type_id) = event.trip_type_id { if let Some(trip_type_id) = event.trip_type_id {
trip_type = TripType::find_by_id(db, trip_type_id).await; trip_type = TripType::find_by_id(db, trip_type_id).await;

View File

@ -25,7 +25,7 @@ pub struct Trip {
is_locked: bool, is_locked: bool,
} }
#[derive(Serialize)] #[derive(Serialize, Debug)]
pub struct TripWithUserAndType { pub struct TripWithUserAndType {
#[serde(flatten)] #[serde(flatten)]
pub trip: Trip, pub trip: Trip,

View File

@ -57,7 +57,7 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
if let Some(msg) = flash { if let Some(msg) = flash {
context.insert("flash", &msg.into_inner()); context.insert("flash", &msg.into_inner());
} }
println!("{user:#?}");
context.insert("loggedin_user", &user); context.insert("loggedin_user", &user);
context.insert("days", &days); context.insert("days", &days);
Template::render("index", context.into_json()) Template::render("index", context.into_json())