From ce499a2842876232318b37811bac0cd074017d2f Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 12 Mar 2022 14:15:10 +0100 Subject: Reload non recurring events when changing weeks --- src/gui/update.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/gui/update.rs b/src/gui/update.rs index 419a6e4..d3eb459 100644 --- a/src/gui/update.rs +++ b/src/gui/update.rs @@ -5,6 +5,7 @@ use std::collections::HashSet; use std::iter::FromIterator; use crate::{ + db, gui::{calendar, form, utils, App}, model::{event, event::Event}, }; @@ -103,6 +104,11 @@ pub async fn event_handler(rx: Receiver, mut app: App) { app.grid.insert_row(1); app.start_date -= Duration::days(7); app.end_date -= Duration::days(7); + + match db::list_non_recurring_between(&app.conn, app.start_date, app.end_date) { + Ok(events) => app.events = events, + Err(err) => eprintln!("{}", err), + }; refresh(&app, &HashSet::from_iter(week_from(app.start_date))); } Msg::SelectNextWeek => { @@ -110,6 +116,11 @@ pub async fn event_handler(rx: Receiver, mut app: App) { app.grid.insert_row(4); app.start_date += Duration::days(7); app.end_date += Duration::days(7); + + match db::list_non_recurring_between(&app.conn, app.start_date, app.end_date) { + Ok(events) => app.events = events, + Err(err) => eprintln!("{}", err), + }; refresh( &app, &HashSet::from_iter(week_from(app.end_date - Duration::days(6))), -- cgit v1.2.3