feat(tasks): filter out tracked intervals smaller than 2mins
This commit is contained in:
parent
7f33bdc9ab
commit
d8eebcfb6a
|
@ -255,6 +255,7 @@ impl TasksRelay {
|
||||||
.map(|str| EventId::from_str(str).ok().map_or(str.to_string(), |id| self.get_task_path(Some(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 omit intervals <2min - but I think I need threeway for that
|
||||||
// TODO alternate color with grey between days
|
// TODO alternate color with grey between days
|
||||||
full.push(format!("{} {}", format_timestamp_local(&event.created_at), new.as_ref().unwrap_or(&"---".to_string())));
|
full.push(format!("{} {}", format_timestamp_local(&event.created_at), new.as_ref().unwrap_or(&"---".to_string())));
|
||||||
last = new;
|
last = new;
|
||||||
|
@ -274,11 +275,14 @@ impl TasksRelay {
|
||||||
let mut vec = Vec::with_capacity(set.len() / 2);
|
let mut vec = Vec::with_capacity(set.len() / 2);
|
||||||
let mut iter = timestamps(set.values(), &ids).tuples();
|
let mut iter = timestamps(set.values(), &ids).tuples();
|
||||||
while let Some(((start, _), (end, _))) = iter.next() {
|
while let Some(((start, _), (end, _))) = iter.next() {
|
||||||
|
// Filter out intervals <2 mins
|
||||||
|
if start.as_u64() + 120 < end.as_u64() {
|
||||||
vec.push(format!("{} - {} by {}",
|
vec.push(format!("{} - {} by {}",
|
||||||
format_timestamp_local(start),
|
format_timestamp_local(start),
|
||||||
format_timestamp_relative_to(end, start),
|
format_timestamp_relative_to(end, start),
|
||||||
self.get_username(key)))
|
self.get_username(key)))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
iter.into_buffer()
|
iter.into_buffer()
|
||||||
.for_each(|(stamp, _)|
|
.for_each(|(stamp, _)|
|
||||||
vec.push(format!("{} started by {}", format_timestamp_local(stamp), self.get_username(key))));
|
vec.push(format!("{} started by {}", format_timestamp_local(stamp), self.get_username(key))));
|
||||||
|
@ -1266,6 +1270,7 @@ fn referenced_event(event: &Event) -> Option<&EventId> {
|
||||||
referenced_events(event).next()
|
referenced_events(event).next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the id of a referenced event if it is contained in the provided ids list.
|
||||||
fn matching_tag_id<'a>(event: &'a Event, ids: &'a [&'a EventId]) -> Option<&'a EventId> {
|
fn matching_tag_id<'a>(event: &'a Event, ids: &'a [&'a EventId]) -> Option<&'a EventId> {
|
||||||
referenced_events(event).find(|id| ids.contains(id))
|
referenced_events(event).find(|id| ids.contains(id))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue