diff options
-rw-r--r-- | src/gui/update.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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<Msg>, 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<Msg>, 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))), |