fix(tasks): view pubkey tracking history reliably

This commit is contained in:
xeruf 2024-12-05 13:18:21 +01:00
parent d159004340
commit df598efdc3
1 changed files with 18 additions and 15 deletions

View File

@ -257,7 +257,7 @@ impl TasksRelay {
/// Dynamic time tracking overview for current task or current user.
pub(crate) fn times_tracked(&self) -> (String, Box<dyn DoubleEndedIterator<Item=String> + '_>) {
self.times_tracked_for(&self.sender.pubkey())
self.times_tracked_with(&self.sender.pubkey())
}
pub(crate) fn history_for(
@ -290,22 +290,25 @@ impl TasksRelay {
pub(crate) fn times_tracked_for(
&self,
key: &PublicKey,
) -> (String, Box<dyn DoubleEndedIterator<Item=String> + '_>) {
match self.history_for(key) {
Some(hist) => (
format!(
"Time-Tracking History for {}:",
self.users.get_displayname(&key)
),
Box::from(hist),
),
None => ("Nothing time-tracked yet".to_string(), Box::from(empty())),
}
}
pub(crate) fn times_tracked_with(
&self,
key: &PublicKey,
) -> (String, Box<dyn DoubleEndedIterator<Item=String> + '_>) {
match self.get_position() {
None => {
match self.history_for(key) {
Some(hist) =>
(
format!("Time-Tracking History for {}:", self.users.get_displayname(&key)),
Box::from(hist),
),
None =>
(
"Nothing time-tracked yet".to_string(),
Box::from(empty()),
)
}
}
None => self.times_tracked_for(key),
Some(id) => {
// TODO show current recursive with pubkey
let ids = [id];