diff options
author | Joris | 2022-03-12 14:15:10 +0100 |
---|---|---|
committer | Joris | 2022-03-12 14:15:10 +0100 |
commit | ce499a2842876232318b37811bac0cd074017d2f (patch) | |
tree | 939f8aa39a2b3ca5169dc1a173a7bea94421d7f5 /src | |
parent | a733748dea76982e835bb720c9b242005402d256 (diff) |
Reload non recurring events when changing weeks
Diffstat (limited to 'src')
-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))), |