diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app/mod.rs | 4 | ||||
-rw-r--r-- | src/views.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs index 0886930..2aecb33 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::default::Default; | 1 | use std::default::Default; |
2 | use std::sync::mpsc::Receiver; | 2 | use std::sync::mpsc::Receiver; |
3 | 3 | ||
4 | use notify::{DebouncedEvent, INotifyWatcher}; | 4 | use notify::{DebouncedEvent, RecommendedWatcher}; |
5 | 5 | ||
6 | use crate::habit::HabitWrapper; | 6 | use crate::habit::HabitWrapper; |
7 | 7 | ||
@@ -16,7 +16,7 @@ pub struct App { | |||
16 | // holds app data | 16 | // holds app data |
17 | habits: Vec<Box<dyn HabitWrapper>>, | 17 | habits: Vec<Box<dyn HabitWrapper>>, |
18 | 18 | ||
19 | _file_watcher: INotifyWatcher, | 19 | _file_watcher: RecommendedWatcher, |
20 | file_event_recv: Receiver<DebouncedEvent>, | 20 | file_event_recv: Receiver<DebouncedEvent>, |
21 | focus: usize, | 21 | focus: usize, |
22 | view_month_offset: u32, | 22 | view_month_offset: u32, |
diff --git a/src/views.rs b/src/views.rs index e11b844..24c8a4d 100644 --- a/src/views.rs +++ b/src/views.rs | |||
@@ -81,8 +81,8 @@ where | |||
81 | let remaining = week.iter().map(|&i| self.remaining(i)).sum::<u32>(); | 81 | let remaining = week.iter().map(|&i| self.remaining(i)).sum::<u32>(); |
82 | let completions = weekly_goal - remaining; | 82 | let completions = weekly_goal - remaining; |
83 | let full = CONFIGURATION.view_width - 8; | 83 | let full = CONFIGURATION.view_width - 8; |
84 | let bars_to_fill = (completions * full as u32) / weekly_goal; | 84 | let bars_to_fill = if weekly_goal > 0 {(completions * full as u32) / weekly_goal} else {0}; |
85 | let percentage = (completions as f64 * 100.) / weekly_goal as f64; | 85 | let percentage = if weekly_goal > 0 {(completions as f64 * 100.) / weekly_goal as f64} else {0.0}; |
86 | printer.with_style(future_style, |p| { | 86 | printer.with_style(future_style, |p| { |
87 | p.print((4, line_nr), &"─".repeat(full)); | 87 | p.print((4, line_nr), &"─".repeat(full)); |
88 | }); | 88 | }); |