diff options
-rw-r--r-- | src/views.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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 | }); |