diff options
author | Joris | 2022-04-24 16:31:49 +0200 |
---|---|---|
committer | Joris | 2022-04-24 16:31:49 +0200 |
commit | 47fe90ee23d8ab04645ef3c7a17459ed40c5b765 (patch) | |
tree | d1aa7d3840a3bd825dcae0a0398fec7ca310f45c /src/gui/update.rs | |
parent | 6d271b09303d924381cc65e7c0b5eb56833780ed (diff) |
Allow to attach categories to events
Diffstat (limited to 'src/gui/update.rs')
-rw-r--r-- | src/gui/update.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/update.rs b/src/gui/update.rs index bd4e7a9..7b3625c 100644 --- a/src/gui/update.rs +++ b/src/gui/update.rs @@ -166,24 +166,32 @@ pub async fn event_handler(rx: Receiver<Msg>, mut app: App) { refresh(&app, &HashSet::from([date])) } Msg::SelectPreviousWeek => { - app.grid.remove_row(4); - app.grid.insert_row(1); + app.calendar.remove_row(4); + app.calendar.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) { + match db::events::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 => { - app.grid.remove_row(1); - app.grid.insert_row(4); + app.calendar.remove_row(1); + app.calendar.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) { + match db::events::list_non_recurring_between( + &app.conn, + app.start_date, + app.end_date, + ) { Ok(events) => app.events = events, Err(err) => eprintln!("{}", err), }; @@ -275,7 +283,7 @@ fn refresh(app: &App, dates: &HashSet<NaiveDate>) { for date in dates { if date >= &app.start_date && date <= &app.end_date { - calendar::refresh_date(app, *date, &repetitions) + calendar::refresh_date(app, *date, &repetitions, &app.categories, &app.default_color) } } } |