forked from janek/mostr
fix(tasks): view pubkey tracking history reliably
This commit is contained in:
parent
d159004340
commit
df598efdc3
1 changed files with 18 additions and 15 deletions
33
src/tasks.rs
33
src/tasks.rs
|
@ -257,7 +257,7 @@ impl TasksRelay {
|
||||||
|
|
||||||
/// Dynamic time tracking overview for current task or current user.
|
/// Dynamic time tracking overview for current task or current user.
|
||||||
pub(crate) fn times_tracked(&self) -> (String, Box<dyn DoubleEndedIterator<Item=String> + '_>) {
|
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(
|
pub(crate) fn history_for(
|
||||||
|
@ -290,22 +290,25 @@ impl TasksRelay {
|
||||||
pub(crate) fn times_tracked_for(
|
pub(crate) fn times_tracked_for(
|
||||||
&self,
|
&self,
|
||||||
key: &PublicKey,
|
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> + '_>) {
|
) -> (String, Box<dyn DoubleEndedIterator<Item=String> + '_>) {
|
||||||
match self.get_position() {
|
match self.get_position() {
|
||||||
None => {
|
None => self.times_tracked_for(key),
|
||||||
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()),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
// TODO show current recursive with pubkey
|
// TODO show current recursive with pubkey
|
||||||
let ids = [id];
|
let ids = [id];
|
||||||
|
|
Loading…
Add table
Reference in a new issue