From 34b098fa2a8d6c2e4451d340555ad3f0fce6b31f Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 6 Jun 2024 17:16:47 +0200 Subject: [PATCH 1/3] cleaner cal --- src/model/event.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model/event.rs b/src/model/event.rs index 6a5aa10..4887952 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -371,7 +371,7 @@ WHERE trip_details.id=? name.push_str(&format!("• {} ", triptype.name)) } if let Some(notes) = tripdetails.notes { - if !notes.is_empty() { + if !notes.is_empty() && event.is_cancelled() { name.push_str(&format!("({notes}) ")) } } From bb48ddb3ded0c306cf453b5f47dd524a2091450a Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 6 Jun 2024 17:17:40 +0200 Subject: [PATCH 2/3] fix ci --- src/model/event.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/model/event.rs b/src/model/event.rs index 4887952..2feb606 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -434,6 +434,6 @@ mod test { let pool = testdb!(); let actual = Event::get_ics_feed(&pool).await; - assert_eq!("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:ics-rs\r\nBEGIN:VEVENT\r\nUID:1@rudernlinz.at\r\nDTSTAMP:19900101T180000\r\nDTSTART:19700101T100000\r\nSUMMARY:test-planned-event (trip_details for a planned event) \r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", actual); + assert_eq!("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:ics-rs\r\nBEGIN:VEVENT\r\nUID:1@rudernlinz.at\r\nDTSTAMP:19900101T180000\r\nDTSTART:19700101T100000\r\nSUMMARY:test-planned-event \r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", actual); } } From fca19745f8884cb5e5d8806249b24ffb463a40f1 Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 6 Jun 2024 17:21:55 +0200 Subject: [PATCH 3/3] even nicer cal entries --- src/model/event.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/model/event.rs b/src/model/event.rs index 2feb606..e4c2dbc 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -360,21 +360,23 @@ WHERE trip_details.id=? event.day.replace('-', ""), event.planned_starting_time.replace(':', "") ))); + let tripdetails = event.trip_details(db).await; let mut name = String::new(); if event.is_cancelled() { - name.push_str("ABGESAGT! :-( "); + name.push_str("ABGESAGT"); + if let Some(notes) = &tripdetails.notes { + if !notes.is_empty() { + name.push_str(&format!(" (Grund: {notes})")) + } + } + + name.push_str("! :-( "); } name.push_str(&format!("{} ", event.name)); - let tripdetails = event.trip_details(db).await; if let Some(triptype) = tripdetails.triptype(db).await { name.push_str(&format!("• {} ", triptype.name)) } - if let Some(notes) = tripdetails.notes { - if !notes.is_empty() && event.is_cancelled() { - name.push_str(&format!("({notes}) ")) - } - } vevent.push(Summary::new(name)); calendar.add_event(vevent); }