Compare commits

...

2 commits

Author SHA1 Message Date
xeruf
a8fb3f919d enhance(tasks): improve state labels 2024-11-24 08:51:54 +01:00
xeruf
044c853993 enhance(tasks): show displayname rather than username where appropriate 2024-11-24 08:47:57 +01:00

View file

@ -308,7 +308,7 @@ impl TasksRelay {
"{} - {} by {}",
format_timestamp_local(start),
format_timestamp_relative_to(end, start),
self.get_username(key)
self.get_displayname(key)
))
}
}
@ -316,7 +316,7 @@ impl TasksRelay {
vec.push(format!(
"{} started by {}",
format_timestamp_local(stamp),
self.get_username(key)
self.get_displayname(key)
))
});
vec
@ -392,7 +392,7 @@ impl TasksRelay {
None => { prompt.push_str(" @ALL"); }
Some(key) =>
if key != self.sender.pubkey() {
prompt.push_str(" ");
prompt.push_str(" @");
prompt.push_str(&self.get_username(&key))
},
}
@ -1293,15 +1293,17 @@ impl TasksRelay {
.tags(ids.into_iter()
.map(|e| self.make_event_tag_from_id(e, MARKER_PROPERTY)))
.tags(tags);
// if self.custom_time.is_none() && self.get_by_id(id).map(|task| {}) {}
info!(
"Task status {} set for \"{}\"{}",
"Task status {} set for \"{}\"{}{}",
TaskState::get_label_for(&state, comment),
self.get_task_title(&id),
self.custom_time
.map(|ts| format!(" at {}", format_timestamp_relative(&ts)))
.unwrap_or_default()
);
.unwrap_or_default(),
self.get_by_id(&id)
.and_then(|task| task.state_at(self.custom_time.unwrap_or_default()))
.map(|ts| format!(" from {}", ts))
.unwrap_or_default());
self.submit(prop)
}
@ -1382,10 +1384,10 @@ impl Display for TasksRelay {
}
writeln!(
lock,
"Active from {} (total tracked time {}m) - State {} since {}",
"Active from {} (total tracked time {}m) - {} since {}",
tracking_stamp.map_or("?".to_string(), |t| format_timestamp_relative(&t)),
self.time_tracked(*t.get_id()) / 60,
state.get_label(),
state,
format_timestamp_relative(&state.time)
)?;
for d in t.descriptions().rev() { writeln!(lock, "{}", d)?; }