Add total time to view pages

This commit is contained in:
Ian Keane 2025-11-25 19:56:59 -05:00
parent e158378a13
commit 9ef6143dbd

View file

@ -646,6 +646,16 @@ impl App {
let start_time = format!("{:02}:{:02}", start_local.hour(), start_local.minute());
let stop_time = format!("{:02}:{:02}", stop_local.hour(), stop_local.minute());
// Calculate duration
let duration = stop_local.signed_duration_since(start_local);
let hours = duration.num_hours();
let minutes = duration.num_minutes() % 60;
let duration_str = if hours > 0 {
format!("({}h {:02}m)", hours, minutes)
} else {
format!("({}m)", minutes)
};
let display_text = if frame.tags.is_empty() {
frame.project.clone()
} else {
@ -653,8 +663,8 @@ impl App {
};
let line_text = format!(
"\t{} to {} {}",
start_time, stop_time, display_text
"\t{} to {} {:>9} {}",
start_time, stop_time, duration_str, display_text
);
lines.push(line_text);
@ -736,6 +746,16 @@ impl App {
let start_time = format!("{:02}:{:02}", start_local.hour(), start_local.minute());
let stop_time = format!("{:02}:{:02}", stop_local.hour(), stop_local.minute());
// Calculate duration
let duration = stop_local.signed_duration_since(start_local);
let hours = duration.num_hours();
let minutes = duration.num_minutes() % 60;
let duration_str = if hours > 0 {
format!("({}h {:02}m)", hours, minutes)
} else {
format!("({}m)", minutes)
};
let tags_str = if frame.tags.is_empty() {
String::new()
} else {
@ -743,8 +763,8 @@ impl App {
};
lines.push(format!(
"\t\t{} to {}{}",
start_time, stop_time, tags_str
"\t\t{} to {} {:>9}{}",
start_time, stop_time, duration_str, tags_str
));
frame_indices.push(*idx);
}