Browse Source

events: use calendar id not url as key

master
Astro 2 years ago
parent
commit
e20973f44f
  1. 4
      src/main.rs

4
src/main.rs

@ -165,7 +165,7 @@ impl Resources {
let mut objs = vec![];
extract_vevent_objs(&mut objs, obj);
for obj in objs {
if let Some(event) = obj_to_event(cal_opts.url.clone(), &obj) {
if let Some(event) = obj_to_event(id.clone(), &obj) {
events.insert(event.id.clone(), event);
} else {
let dtstart: Option<&str> = obj.get("DTSTART");
@ -183,7 +183,7 @@ impl Resources {
println!("{} events {}", events.len(), cal_opts.url);
diesel::delete(schema::events::dsl::events)
.filter(schema::events::dsl::calendar.eq(cal_opts.url))
.filter(schema::events::dsl::calendar.eq(id))
.execute(&db)?;
for event in events.values() {
diesel::insert_into(schema::events::dsl::events)

Loading…
Cancel
Save