forked from janek/mostr
1
0
Fork 0

style(tasks): some bits of documentation

This commit is contained in:
xeruf 2024-09-14 16:17:30 +03:00
parent 0744e86922
commit cb75a5749f
1 changed files with 8 additions and 4 deletions

View File

@ -201,9 +201,10 @@ impl Tasks {
last = new; last = new;
} }
} }
// TODO show history for active tags
("Your Time-Tracking History:".to_string(), Box::from(full.into_iter())) ("Your Time-Tracking History:".to_string(), Box::from(full.into_iter()))
} else { } else {
("You have nothing tracked yet".to_string(), Box::from(empty())) ("You have nothing time-tracked yet".to_string(), Box::from(empty()))
} }
} }
Some(id) => { Some(id) => {
@ -220,7 +221,7 @@ impl Tasks {
} }
iter.into_buffer() iter.into_buffer()
.for_each(|(stamp, _)| .for_each(|(stamp, _)|
vec.push(format!("{} started by {}", format_timestamp_local(stamp), self.get_author(key)))); vec.push(format!("{} started by {}", format_timestamp_local(stamp), self.get_author(key))));
vec vec
}).sorted_unstable(); // TODO sorting depends on timestamp format - needed to interleave different people }).sorted_unstable(); // TODO sorting depends on timestamp format - needed to interleave different people
(format!("Times Tracked on {:?}", self.get_task_title(id)), Box::from(history)) (format!("Times Tracked on {:?}", self.get_task_title(id)), Box::from(history))
@ -680,8 +681,8 @@ impl Tasks {
filtered_fuzzy.push(task.event.id) filtered_fuzzy.push(task.event.id)
} }
} }
// Find global exact match
for task in self.tasks.values() { for task in self.tasks.values() {
// Find global exact match
if task.get_filter_title().to_ascii_lowercase() == lowercase_arg && if task.get_filter_title().to_ascii_lowercase() == lowercase_arg &&
// exclude closed tasks and their subtasks // exclude closed tasks and their subtasks
!self.traverse_up_from(Some(*task.get_id())).any(|t| t.pure_state() == State::Closed) { !self.traverse_up_from(Some(*task.get_id())).any(|t| t.pure_state() == State::Closed) {
@ -701,7 +702,10 @@ impl Tasks {
filtered filtered
} }
/// Finds out what to do with the given string. /// Finds out what to do with the given string, one of:
/// - filtering the visible tasks
/// - entering the only matching task
/// - creating a new task
/// Returns an EventId if a new Task was created. /// Returns an EventId if a new Task was created.
pub(crate) fn filter_or_create(&mut self, position: Option<&EventId>, arg: &str) -> Option<EventId> { pub(crate) fn filter_or_create(&mut self, position: Option<&EventId>, arg: &str) -> Option<EventId> {
let filtered = self.get_matching(position, arg); let filtered = self.get_matching(position, arg);