forked from janek/mostr
feat: implement priority filtering
This commit is contained in:
parent
91b6047f9a
commit
561fd9e1e5
|
@ -194,7 +194,7 @@ impl Task {
|
|||
"created" => Some(format_timestamp_local(&self.event.created_at)),
|
||||
"kind" => Some(self.event.kind.to_string()),
|
||||
// Dynamic
|
||||
"priority" | "prio" => self.priority_raw().map(|c| c.to_string()),
|
||||
"priority" => self.priority_raw().map(|c| c.to_string()),
|
||||
"status" => self.state_label().map(|c| c.to_string()),
|
||||
"desc" => self.descriptions().last().cloned(),
|
||||
"description" => Some(self.descriptions().join(" ")),
|
||||
|
|
|
@ -446,6 +446,9 @@ impl TasksRelay {
|
|||
|
||||
fn filter(&self, task: &Task) -> bool {
|
||||
self.state.matches(task) &&
|
||||
self.priority.is_none_or(|prio| {
|
||||
task.priority().unwrap_or(DEFAULT_PRIO) >= prio
|
||||
}) &&
|
||||
task.tags.as_ref().map_or(true, |tags| {
|
||||
!tags.iter().any(|tag| self.tags_excluded.contains(tag))
|
||||
}) &&
|
||||
|
@ -540,6 +543,12 @@ impl TasksRelay {
|
|||
"progress" => prog_string.clone(),
|
||||
|
||||
"author" | "creator" => format!("{:.6}", self.get_username(&task.event.pubkey)), // FIXME temporary until proper column alignment
|
||||
"prio" => task.priority_raw().map(|p| p.to_string()).unwrap_or_else(||
|
||||
if self.priority.is_some() {
|
||||
DEFAULT_PRIO.to_string().dimmed().to_string()
|
||||
} else {
|
||||
"".to_string()
|
||||
}),
|
||||
"path" => self.get_task_path(Some(task.event.id)),
|
||||
"rpath" => self.relative_path(task.event.id),
|
||||
// TODO format strings configurable
|
||||
|
|
Loading…
Reference in New Issue