about summary refs log tree commit diff
path: root/src/ui/tasks_page.rs
diff options
context:
space:
mode:
authorRicky Kresslein <rk@lakoliu.com>2022-03-03 10:02:01 +0100
committerRicky Kresslein <rk@lakoliu.com>2022-03-03 10:02:01 +0100
commit0f05a52d429c41b538fa3b362cad3a54db04e5cd (patch)
tree2c7873ffc54a771b15cf21f96b4f8dd5fa3e1a6c /src/ui/tasks_page.rs
parent8ea50db6fa4c36383a375db2f1e9ecb9a771d8c2 (diff)
downloadFurtherance-0f05a52d429c41b538fa3b362cad3a54db04e5cd.tar.zst
Added 'limit days shown' setting
Diffstat (limited to 'src/ui/tasks_page.rs')
-rwxr-xr-xsrc/ui/tasks_page.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ui/tasks_page.rs b/src/ui/tasks_page.rs
index fbbaf0c..9f0aed3 100755
--- a/src/ui/tasks_page.rs
+++ b/src/ui/tasks_page.rs
@@ -22,6 +22,7 @@ use chrono::{DateTime, Local, Duration};
 
 use crate::ui::FurTasksGroup;
 use crate::database;
+use crate::settings_manager;
 
 mod imp {
     use super::*;
@@ -122,6 +123,15 @@ impl FurTasksPage {
                 tasks_sorted_by_day.push(same_date_list.clone());
             }
             i += 1;
+            if settings_manager::get_bool("limit-tasks") {
+                if uniq_date_list.len() > settings_manager::get_int("limit-days") as usize {
+                    if same_date_list.len() > 0 && i != len {
+                        tasks_sorted_by_day.push(same_date_list.clone());
+                    }
+                    uniq_date_list.pop();
+                    break;
+                }
+            }
         }
 
         // Create FurTasksGroups for all unique days