forked from janek/mostr
1
0
Fork 0

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 {
None => tasks.move_to(None),
Some(arg) => {
if parse_tracking_stamp(arg).map(|stamp| tasks.track_at(stamp, None)).is_none() {
// So the error message is not covered up
continue;
if parse_tracking_stamp(arg).map(|stamp| tasks.track_at(stamp, None)).is_some() {
let (label, times) = tasks.times_tracked();
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 {
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(
build_tracking(task)
.custom_created_at(time)