forked from janek/mostr
1
0
Fork 0

fix: more consistent time-tracking history

This commit is contained in:
xeruf 2024-08-26 22:41:35 +03:00
parent 1263e39fb3
commit 13dac88ded
2 changed files with 5 additions and 3 deletions

View File

@ -562,7 +562,8 @@ async fn main() -> Result<()> {
if let Some(arg) = arg { if let Some(arg) = arg {
if tasks.track_from(arg) { if tasks.track_from(arg) {
let (label, times) = tasks.times_tracked(); let (label, times) = tasks.times_tracked();
println!("{}\n{}", label.italic(), times.rev().take(15).join("\n")); println!("{}\n{}", label.italic(),
times.rev().take(15).collect_vec().iter().rev().join("\n"));
} }
// TODO show history of author / pubkey // TODO show history of author / pubkey
} else { } else {
@ -578,7 +579,8 @@ async fn main() -> Result<()> {
Some(arg) => { Some(arg) => {
if parse_tracking_stamp(arg).and_then(|stamp| tasks.track_at(stamp, None)).is_some() { if parse_tracking_stamp(arg).and_then(|stamp| tasks.track_at(stamp, None)).is_some() {
let (label, times) = tasks.times_tracked(); let (label, times) = tasks.times_tracked();
println!("{}\n{}", label.italic(), times.rev().take(15).join("\n")); println!("{}\n{}", label.italic(),
times.rev().take(15).collect_vec().iter().rev().join("\n"));
} }
// So the error message is not covered up // So the error message is not covered up
continue; continue;

View File

@ -189,7 +189,7 @@ impl Tasks {
for event in set { for event in set {
let new = some_non_empty(&event.tags.iter() let new = some_non_empty(&event.tags.iter()
.filter_map(|t| t.content()) .filter_map(|t| t.content())
.map(|str| EventId::from_str(str).ok().map_or(str.to_string(), |id| self.get_task_title(&id))) .map(|str| EventId::from_str(str).ok().map_or(str.to_string(), |id| self.get_task_path(Some(id))))
.join(" ")); .join(" "));
if new != last { if new != last {
// TODO alternate color with grey between days // TODO alternate color with grey between days