This commit is contained in:
philipp 2023-06-05 13:27:08 +02:00
parent 2530d6343d
commit f64128e0b1

View File

@ -208,51 +208,51 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM planned_even
pub async fn get_ics_feed(db: &SqlitePool) -> String {
let mut res = String::from(
r#"BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//rudernlinz.at//Trips//DE
X-WR-CALNAME:Ruderausfahrten
BEGIN:VTIMEZONE
TZID:Europe/Vienna
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Vienna
X-LIC-LOCATION:Europe/Vienna
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
r#"BEGIN:VCALENDAR\r\n
VERSION:2.0\r\n
PRODID:-//rudernlinz.at//Trips//DE\r\n
X-WR-CALNAME:Ruderausfahrten\r\n
BEGIN:VTIMEZONE\r\n
TZID:Europe/Vienna\r\n
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Vienna\r\n
X-LIC-LOCATION:Europe/Vienna\r\n
BEGIN:DAYLIGHT\r\n
TZOFFSETFROM:+0100\r\n
TZOFFSETTO:+0200\r\n
TZNAME:CEST\r\n
DTSTART:19700329T020000\r\n
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\n
END:DAYLIGHT\r\n
BEGIN:STANDARD\r\n
TZOFFSETFROM:+0200\r\n
TZOFFSETTO:+0100\r\n
TZNAME:CET\r\n
DTSTART:19701025T030000\r\n
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\n
END:STANDARD\r\n
END:VTIMEZONE"#,
);
let events = PlannedEvent::all(db).await;
for event in events {
res.push_str("\nBEGIN:VEVENT");
res.push_str(&format!("\nUID:{}@rudernlinz.at", event.id));
res.push_str("\nBEGIN:VEVENT\r\n");
res.push_str(&format!("\nUID:{}@rudernlinz.at\r\n", event.id));
res.push_str(&format!(
"\nDTSTART;TZID=Europe/Vienna:{}T{}00",
"\nDTSTART;TZID=Europe/Vienna:{}T{}00\r\n",
event.day.replace('-', ""),
event.planned_starting_time.replace(':', "")
));
res.push_str(&format!(
"\nDTSTAMP;TZID=Europe/Vienna:{}T{}00",
"\nDTSTAMP;TZID=Europe/Vienna:{}T{}00\r\n",
event.day.replace('-', ""),
event.planned_starting_time.replace(':', "")
));
res.push_str(&format!("\nSUMMARY:{}", event.name));
res.push_str(&format!("\nSUMMARY:{}\r\n", event.name));
res.push_str("\nEND:VEVENT");
res.push_str("\nEND:VEVENT\r\n");
}
res.push_str("\nEND:VCALENDAR");
res.push_str("\nEND:VCALENDAR\r\n");
res
}
}