fix: more intuitive feedback when stopping timetracking

This commit is contained in:
xeruf 2024-08-25 13:50:21 +03:00
parent 84e46827ce
commit a0f5d62c81
2 changed files with 8 additions and 4 deletions

View File

@ -574,10 +574,12 @@ async fn main() -> Result<()> {
match arg { match arg {
None => tasks.move_to(None), None => tasks.move_to(None),
Some(arg) => { Some(arg) => {
if parse_tracking_stamp(arg).map(|stamp| tasks.track_at(stamp, None)).is_none() { if parse_tracking_stamp(arg).map(|stamp| tasks.track_at(stamp, None)).is_some() {
// So the error message is not covered up let (label, times) = tasks.times_tracked();
continue; println!("{}\n{}", label.italic(), times.rev().take(15).join("\n"));
} }
// So the error message is not covered up
continue;
} }
} }
} }

View File

@ -735,7 +735,9 @@ impl Tasks {
} }
pub(crate) fn track_at(&mut self, time: Timestamp, task: Option<EventId>) -> EventId { pub(crate) fn track_at(&mut self, time: Timestamp, task: Option<EventId>) -> EventId {
info!("{} from {}", task.map_or(String::from("Stopping time-tracking"), |id| format!("Tracking \"{}\"", self.get_task_title(&id))), format_timestamp_relative(&time)); info!("{} {}", task.map_or(
String::from("Stopping time-tracking at"),
|id| format!("Tracking \"{}\" from", self.get_task_title(&id))), format_timestamp_relative(&time));
self.submit( self.submit(
build_tracking(task) build_tracking(task)
.custom_created_at(time) .custom_created_at(time)