diff --git a/src/model/event.rs b/src/model/event.rs index bec7892..a67a077 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -98,6 +98,7 @@ FROM trip WHERE planned_event_id = ? } } +#[derive(Debug)] pub struct EventUpdate<'a> { pub name: &'a str, pub planned_amount_cox: i32, @@ -361,7 +362,7 @@ WHERE trip_details.id=? ))); let mut name = String::new(); if event.is_cancelled() { - name.push_str("ABGESAGT :-( "); + name.push_str("ABGESAGT! :-( "); } name.push_str(&format!("{} ", event.name)); @@ -370,7 +371,9 @@ WHERE trip_details.id=? name.push_str(&format!("• {} ", triptype.name)) } if let Some(notes) = tripdetails.notes { - name.push_str(&format!("({notes}) ")) + if !notes.is_empty() { + name.push_str(&format!("({notes}) ")) + } } vevent.push(Summary::new(name)); calendar.add_event(vevent); diff --git a/src/tera/admin/event.rs b/src/tera/admin/event.rs index cefde95..4644956 100644 --- a/src/tera/admin/event.rs +++ b/src/tera/admin/event.rs @@ -40,7 +40,7 @@ async fn create( } //TODO: add constraints (e.g. planned_amount_cox > 0) -#[derive(FromForm)] +#[derive(FromForm, Debug)] struct UpdateEventForm<'r> { id: i64, name: &'r str, diff --git a/templates/planned.html.tera b/templates/planned.html.tera index 0ff4851..649df55 100644 --- a/templates/planned.html.tera +++ b/templates/planned.html.tera @@ -251,6 +251,7 @@ {{ macros::input(label='', name='planned_amount_cox', type='hidden', value=event.planned_amount_cox) }} {{ macros::input(label='', name='always_show', type='hidden', value=event.always_show) }} {{ macros::input(label='', name='is_locked', type='hidden', value=event.is_locked) }} + {{ macros::input(label='', name='trip_type', type='hidden', value=event.trip_type_id) }}