From 52b869cca5abc62a5370b850aae4e2649c6f7c99 Mon Sep 17 00:00:00 2001 From: Campbell Alden Date: Wed, 10 Jan 2024 10:23:26 +0900 Subject: [PATCH] Sort tasks by completion date (newer later) --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 99e04d4..914723b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,9 +89,12 @@ fn main() -> Result<()> { ReportTypes::Signoff => Task::logbook_today(), ReportTypes::Cycle => Task::logbook_this_cycle(), }?; - let reported: Vec = tasks.into_iter().filter(|task| { + let mut reported: Vec = tasks.into_iter().filter(|task| { args.tags.iter().all(|tag| task.has_tag(tag)) }).collect(); + reported.sort_by(|a, b| { + a.completion_date.cmp(&b.completion_date) + }); let report = args.report.format_tasks(reported, &args.tags, !args.no_sanitize); println!("{report}");