From 4550aeff8f835af7d2a4fe197d4b0c6eaa42b61a Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sat, 13 Feb 2021 18:31:09 -0700 Subject: [PATCH] Support custom priority --- Cargo.lock | 2 +- src/app.rs | 3 +-- src/task_report.rs | 9 ++++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59780bb..3ebdc9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -768,7 +768,7 @@ dependencies = [ [[package]] name = "task-hookrs" version = "0.7.0" -source = "git+https://github.com/matthiasbeyer/task-hookrs#bc70cae87ee3b48c720cf446c7f70374b78692e7" +source = "git+https://github.com/matthiasbeyer/task-hookrs#e40c961c074cdeec067854b617c30e69fa2c0448" dependencies = [ "chrono", "derive_builder", diff --git a/src/app.rs b/src/app.rs index 5516ee0..438769c 100644 --- a/src/app.rs +++ b/src/app.rs @@ -17,7 +17,6 @@ use task_hookrs::date::Date; use task_hookrs::import::import; use task_hookrs::status::TaskStatus; use task_hookrs::task::Task; -use task_hookrs::uda::UDAValue; use uuid::Uuid; use unicode_segmentation::Graphemes; @@ -1338,7 +1337,7 @@ impl TTApp { add_tag(&mut task, "PROJECT".to_string()); } if task.priority().is_some() { - add_tag(&mut task, "PROJECT".to_string()); + add_tag(&mut task, "PRIORITY".to_string()); } if task.due().is_some() { add_tag(&mut task, "DUE".to_string()); diff --git a/src/task_report.rs b/src/task_report.rs index d1b0898..c328a14 100644 --- a/src/task_report.rs +++ b/src/task_report.rs @@ -197,6 +197,10 @@ impl TaskReportTable { }, "status.short" => task.status().to_string().chars().next().unwrap().to_string(), "status" => task.status().to_string(), + "priority" => match task.priority() { + Some(p) => p.to_owned(), + None => "".to_string(), + }, "project" => match task.project() { Some(p) => p.to_string(), None => "".to_string(), @@ -218,9 +222,8 @@ impl TaskReportTable { } else { let mut dt = vec![]; for u in v { - match tasks.iter().find(|t| t.uuid() == u) { - Some(t) => dt.push(t.id().unwrap()), - None => (), + if let Some(t) = tasks.iter().find(|t| t.uuid() == u) { + dt.push(t.id().unwrap()) } } join(dt.iter().map(|i| i.to_string()), " ")