diff options
author | Ricky Kresslein <rk@lakoliu.com> | 2022-04-14 17:44:21 +0300 |
---|---|---|
committer | Ricky Kresslein <rk@lakoliu.com> | 2022-04-14 17:44:21 +0300 |
commit | eb80833b5d736180baa49c7f3787fe30eba161db (patch) | |
tree | f4fbc30b8f80002a57176d9d77a414160b16f5c0 /src/ui/tasks_page.rs | |
parent | dd7f8f8a6462b81cadf9f5f2a0b2a31757c59c18 (diff) | |
download | Furtherance-eb80833b5d736180baa49c7f3787fe30eba161db.tar.zst |
Add daily time sums (Issue #17)
Diffstat (limited to 'src/ui/tasks_page.rs')
-rwxr-xr-x | src/ui/tasks_page.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ui/tasks_page.rs b/src/ui/tasks_page.rs index 82819c7..ac4e20e 100755 --- a/src/ui/tasks_page.rs +++ b/src/ui/tasks_page.rs @@ -149,8 +149,22 @@ impl FurTasksPage { } else { group.set_title(&uniq_date_list[i]); } + self.add(&group); group.add_task_model(tasks_sorted_by_day[i].clone()); + + // Set total time for each day + let day_total_time = group.get_total_day_time(); + // Format total time to readable string + let h = day_total_time / 3600; + let m = day_total_time % 3600 / 60; + let s = day_total_time % 60; + let mut total_time_str = format!("{:02}:{:02}:{:02}", h, m, s); + if !settings_manager::get_bool("show-seconds") { + total_time_str = format!("{:02}:{:02}", h, m); + } + group.set_description(Some(&total_time_str)); + imp.all_groups.borrow_mut().push(group); } } |