Comment out some code snippets that might break things at the moment

This commit is contained in:
Lennart
2025-06-02 22:36:40 +02:00
parent 13128a5caa
commit cf3e213894
3 changed files with 47 additions and 47 deletions

View File

@@ -199,13 +199,13 @@ impl RecurrenceRule {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{CalDateTime, rrule::RecurrenceRule}; // use crate::{CalDateTime, rrule::RecurrenceRule};
#[test] // #[test]
fn test_between() { // fn test_between() {
// Example: Last workday of the month // // Example: Last workday of the month
let rrule = RecurrenceRule::parse("FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1").unwrap(); // let rrule = RecurrenceRule::parse("FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1").unwrap();
let start = CalDateTime::parse("20250516T133000Z", None).unwrap(); // let start = CalDateTime::parse("20250516T133000Z", None).unwrap();
assert_eq!(rrule.between(start, None, Some(4)), vec![]); // assert_eq!(rrule.between(start, None, Some(4)), vec![]);
} // }
} }

View File

@@ -67,40 +67,40 @@ impl EventObject {
RecurrenceRule::parse(rrule).map(Some) RecurrenceRule::parse(rrule).map(Some)
} }
pub fn expand_recurrence(&self) -> Result<Vec<IcalEvent>, Error> { // pub fn expand_recurrence(&self) -> Result<Vec<IcalEvent>, Error> {
if let Some(rrule) = self.recurrence_rule()? { // if let Some(rrule) = self.recurrence_rule()? {
let mut events = vec![]; // let mut events = vec![];
let first_occurence = self.get_first_occurence()?.unwrap(); // let first_occurence = self.get_first_occurence()?.unwrap();
let dates = rrule.between(first_occurence, None, None); // let dates = rrule.between(first_occurence, None, None);
//
for date in dates { // for date in dates {
let dtstart_utc = date; // let dtstart_utc = date;
let mut ev = self.event.clone(); // let mut ev = self.event.clone();
ev.remove_property("RRULE"); // ev.remove_property("RRULE");
ev.set_property(Property { // ev.set_property(Property {
name: "RECURRENCE-ID".to_string(), // name: "RECURRENCE-ID".to_string(),
value: Some(dtstart_utc.format()), // value: Some(dtstart_utc.format()),
params: None, // params: None,
}); // });
ev.set_property(Property { // ev.set_property(Property {
name: "DTSTART".to_string(), // name: "DTSTART".to_string(),
value: Some(dtstart_utc.format()), // value: Some(dtstart_utc.format()),
params: None, // params: None,
}); // });
if let Some(duration) = self.get_duration()? { // if let Some(duration) = self.get_duration()? {
ev.set_property(Property { // ev.set_property(Property {
name: "DTEND".to_string(), // name: "DTEND".to_string(),
value: Some((dtstart_utc + duration).format()), // value: Some((dtstart_utc + duration).format()),
params: None, // params: None,
}); // });
} // }
events.push(ev); // events.push(ev);
} // }
Ok(events) // Ok(events)
} else { // } else {
Ok(vec![self.event.clone()]) // Ok(vec![self.event.clone()])
} // }
} // }
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -184,11 +184,11 @@ impl CalendarObject {
pub fn expand_recurrence(&self) -> Result<String, Error> { pub fn expand_recurrence(&self) -> Result<String, Error> {
// Only events can be expanded // Only events can be expanded
match &self.data { match &self.data {
CalendarObjectComponent::Event(event) => { // CalendarObjectComponent::Event(event) => {
let mut cal = self.cal.clone(); // let mut cal = self.cal.clone();
cal.events = event.expand_recurrence()?; // cal.events = event.expand_recurrence()?;
Ok(cal.generate()) // Ok(cal.generate())
} // }
_ => Ok(self.get_ics().to_string()), _ => Ok(self.get_ics().to_string()),
} }
} }