From a510603825050a5face70d5387f0be830a4d685b Mon Sep 17 00:00:00 2001 From: Felix Zwettler Date: Tue, 7 Jun 2022 23:14:29 +0200 Subject: add csv export --- src/ui/tasks_page.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/ui/tasks_page.rs') 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 . +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>, } - #[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 = Vec::new(); let mut same_date_list: Vec = Vec::new(); let mut tasks_sorted_by_day: Vec> = 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 { } } } - -- cgit 1.4.1