better usage of the lib API

This commit is contained in:
Mylloon 2024-01-30 15:19:00 +01:00
parent 6c9ccff574
commit 4d0f14d045
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -2,7 +2,7 @@ use std::sync::Arc;
use chrono::TimeZone; use chrono::TimeZone;
use ics::{ use ics::{
parameters, parameters::{Language, TzIDParam},
properties::{ properties::{
Categories, Class, Comment, Description, DtEnd, DtStart, Location, Summary, Transp, Categories, Class, Comment, Description, DtEnd, DtStart, Location, Summary, Transp,
}, },
@ -45,12 +45,12 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
// Start time of the course // Start time of the course
let mut date_start = DtStart::new(dt_ical(course.dtstart.unwrap())); let mut date_start = DtStart::new(dt_ical(course.dtstart.unwrap()));
date_start.append(parameters!("TZID" => timezone_name)); date_start.add(TzIDParam::new(timezone_name));
event.push(date_start); event.push(date_start);
// End time of the course // End time of the course
let mut date_end = DtEnd::new(dt_ical(course.dtend.unwrap())); let mut date_end = DtEnd::new(dt_ical(course.dtend.unwrap()));
date_end.append(parameters!("TZID" => timezone_name)); date_end.add(TzIDParam::new(timezone_name));
event.push(date_end); event.push(date_end);
// Room location // Room location
@ -65,7 +65,7 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &mut Str
// Course's name // Course's name
let mut course_name = Summary::new(format!("{} - {}", categories, course.name)); let mut course_name = Summary::new(format!("{} - {}", categories, course.name));
course_name.append(parameters!("LANGUAGE" => "fr")); course_name.add(Language::new("fr"));
event.push(course_name); event.push(course_name);
// Course's category // Course's category