diff options
author | Akshay <[email protected]> | 2020-07-20 03:19:27 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-07-20 03:19:27 +0100 |
commit | 7c3433cb22c7ca450dbcb7e351d54e22ea200c4d (patch) | |
tree | ddb413753d693078bf1991c0a5e770694274da8c /src | |
parent | c357ba5e2bd9bc1cb95f6d38412e1d84752aa70e (diff) | |
parent | 852e5dc3a9a92761d019aaad1f1f36649610d815 (diff) |
Merge branch 'fix/week-view'; fixes #5, #4
Diffstat (limited to 'src')
-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 | }); |