Sort tasks by completion date (newer later)

This commit is contained in:
Campbell Alden 2024-01-10 10:23:26 +09:00
parent 9fa5818fde
commit 52b869cca5

View file

@ -89,9 +89,12 @@ fn main() -> Result<()> {
ReportTypes::Signoff => Task::logbook_today(),
ReportTypes::Cycle => Task::logbook_this_cycle(),
}?;
let reported: Vec<Task> = tasks.into_iter().filter(|task| {
let mut reported: Vec<Task> = 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}");