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,13 +574,15 @@ 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() {
let (label, times) = tasks.times_tracked();
println!("{}\n{}", label.italic(), times.rev().take(15).join("\n"));
}
// So the error message is not covered up // So the error message is not covered up
continue; continue;
} }
} }
} }
}
Some('.') => { Some('.') => {
let mut dots = 1; let mut dots = 1;

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)