feat: hide time if empty
This commit is contained in:
parent
fbbdd5eef8
commit
50cc8de6a2
|
@ -142,7 +142,7 @@ impl Task {
|
|||
"parentid" => self.parent_id().map(|i| i.to_string()),
|
||||
"state" => self.state().map(|s| s.to_string()),
|
||||
"name" => Some(self.event.content.clone()),
|
||||
"time" => Some(format!("{}m", self.time_tracked().div(60))),
|
||||
"time" => Some(self.time_tracked().div(60)).filter(|t| t>&0).map(|t| format!("{}m", t)),
|
||||
"desc" => self.descriptions().last().cloned(),
|
||||
"description" => Some(self.descriptions().join(" ")),
|
||||
"hashtags" => self.filter_tags(|tag| {
|
||||
|
|
|
@ -44,8 +44,8 @@ impl Tasks {
|
|||
properties: vec![
|
||||
"state".into(),
|
||||
"rtime".into(),
|
||||
"hashtags".into(),
|
||||
"rpath".into(),
|
||||
"tags".into(),
|
||||
"desc".into(),
|
||||
],
|
||||
position: None,
|
||||
|
@ -240,7 +240,11 @@ impl Tasks {
|
|||
"rpath" => self.relative_path(task.event.id),
|
||||
"rtime" => {
|
||||
let time = self.total_time_tracked(&task.event.id);
|
||||
format!("{:02}:{:02}", time / 3600, time / 60 % 60)
|
||||
if time > 60 {
|
||||
format!("{:02}:{:02}", time / 3600, time / 60 % 60)
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
}
|
||||
prop => task.get(prop).unwrap_or(String::new()),
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue