Compare commits
1 Commits
6de7920af1
...
b19f2a85d8
Author | SHA1 | Date |
---|---|---|
xeruf | b19f2a85d8 |
|
@ -1,5 +1,6 @@
|
||||||
use std::collections::{BTreeSet, HashSet};
|
use std::collections::{BTreeSet, HashSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::ops::Div;
|
||||||
|
|
||||||
use nostr_sdk::{Event, EventBuilder, EventId, Kind, Tag, Timestamp};
|
use nostr_sdk::{Event, EventBuilder, EventId, Kind, Tag, Timestamp};
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ impl Task {
|
||||||
"parentid" => self.parent_id().map(|i| i.to_string()),
|
"parentid" => self.parent_id().map(|i| i.to_string()),
|
||||||
"state" => self.state().map(|s| s.to_string()),
|
"state" => self.state().map(|s| s.to_string()),
|
||||||
"name" => Some(self.event.content.clone()),
|
"name" => Some(self.event.content.clone()),
|
||||||
"time" => Some(self.time_tracked().to_string()), // TODO: format properly
|
"time" => Some(format!("{}m", self.time_tracked().div(60))),
|
||||||
"tags" => self.tags.as_ref().map(|tags| {
|
"tags" => self.tags.as_ref().map(|tags| {
|
||||||
tags.iter()
|
tags.iter()
|
||||||
.map(|t| format!("{}", t.content().unwrap()))
|
.map(|t| format!("{}", t.content().unwrap()))
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl Tasks {
|
||||||
tasks: Default::default(),
|
tasks: Default::default(),
|
||||||
properties: vec![
|
properties: vec![
|
||||||
"state".into(),
|
"state".into(),
|
||||||
"ttime".into(),
|
"rtime".into(),
|
||||||
"rpath".into(),
|
"rpath".into(),
|
||||||
"tags".into(),
|
"tags".into(),
|
||||||
"desc".into(),
|
"desc".into(),
|
||||||
|
@ -192,7 +192,10 @@ impl Tasks {
|
||||||
self.traverse_up_from(Some(task.event.id))
|
self.traverse_up_from(Some(task.event.id))
|
||||||
.take_while(|t| Some(t.event.id) != self.position)
|
.take_while(|t| Some(t.event.id) != self.position)
|
||||||
),
|
),
|
||||||
"ttime" => self.total_time_tracked(&task.event.id).to_string(),
|
"rtime" => {
|
||||||
|
let time = self.total_time_tracked(&task.event.id);
|
||||||
|
format!("{:02}:{:02}", time / 3600, time / 60 % 60)
|
||||||
|
},
|
||||||
prop => task.get(prop).unwrap_or(String::new()),
|
prop => task.get(prop).unwrap_or(String::new()),
|
||||||
})
|
})
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
|
|
Loading…
Reference in New Issue