about summary refs log tree commit diff
path: root/src/ui/tasks_page.rs
diff options
context:
space:
mode:
authorFelix Zwettler <f.zwettler@posteo.de>2022-06-07 23:14:29 +0200
committerFelix Zwettler <f.zwettler@posteo.de>2022-06-07 23:34:00 +0200
commita510603825050a5face70d5387f0be830a4d685b (patch)
treeaac28a23249c1d483da25304a9e75c925bda68f5 /src/ui/tasks_page.rs
parent67679138574b083d838294bf82b6058a54b6a13d (diff)
downloadFurtherance-a510603825050a5face70d5387f0be830a4d685b.tar.zst
add csv export
Diffstat (limited to 'src/ui/tasks_page.rs')
-rwxr-xr-xsrc/ui/tasks_page.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/ui/tasks_page.rs b/src/ui/tasks_page.rs
index 7fb6e63..911b005 100755
--- a/src/ui/tasks_page.rs
+++ b/src/ui/tasks_page.rs
@@ -14,16 +14,16 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
+use adw::prelude::{PreferencesGroupExt, PreferencesPageExt};
 use adw::subclass::prelude::*;
-use adw::prelude::{PreferencesPageExt, PreferencesGroupExt};
+use chrono::{DateTime, Duration, Local};
 use gettextrs::*;
 use gtk::subclass::prelude::*;
 use gtk::{glib, prelude::*};
-use chrono::{DateTime, Local, Duration};
 
-use crate::ui::FurTasksGroup;
-use crate::database;
+use crate::database::{self, SortOrder, TaskSort};
 use crate::settings_manager;
+use crate::ui::FurTasksGroup;
 
 mod imp {
     use super::*;
@@ -37,7 +37,6 @@ mod imp {
         pub all_groups: RefCell<Vec<FurTasksGroup>>,
     }
 
-
     #[glib::object_subclass]
     impl ObjectSubclass for FurTasksPage {
         const NAME: &'static str = "FurTasksPage";
@@ -88,10 +87,8 @@ impl FurTasksPage {
     pub fn build_task_list(&self) {
         let imp = imp::FurTasksPage::from_instance(&self);
 
-        let mut tasks_list = database::retrieve().unwrap();
+        let tasks_list = database::retrieve(TaskSort::StartTime, SortOrder::Descending).unwrap();
 
-        // Reversing chronological order of tasks_list
-        tasks_list.reverse();
         let mut uniq_date_list: Vec<String> = Vec::new();
         let mut same_date_list: Vec<database::Task> = Vec::new();
         let mut tasks_sorted_by_day: Vec<Vec<database::Task>> = Vec::new();
@@ -144,7 +141,7 @@ impl FurTasksPage {
             let group = FurTasksGroup::new();
             if uniq_date_list[i] == today {
                 group.set_title(&gettext("Today"));
-            } else if uniq_date_list[i] == yesterday{
+            } else if uniq_date_list[i] == yesterday {
                 group.set_title(&gettext("Yesterday"));
             } else {
                 group.set_title(&uniq_date_list[i]);
@@ -171,4 +168,3 @@ impl FurTasksPage {
         }
     }
 }
-