Add total time to view pages
This commit is contained in:
parent
e158378a13
commit
9ef6143dbd
1 changed files with 24 additions and 4 deletions
28
src/app.rs
28
src/app.rs
|
|
@ -646,6 +646,16 @@ impl App {
|
||||||
let start_time = format!("{:02}:{:02}", start_local.hour(), start_local.minute());
|
let start_time = format!("{:02}:{:02}", start_local.hour(), start_local.minute());
|
||||||
let stop_time = format!("{:02}:{:02}", stop_local.hour(), stop_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() {
|
let display_text = if frame.tags.is_empty() {
|
||||||
frame.project.clone()
|
frame.project.clone()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -653,8 +663,8 @@ impl App {
|
||||||
};
|
};
|
||||||
|
|
||||||
let line_text = format!(
|
let line_text = format!(
|
||||||
"\t{} to {} {}",
|
"\t{} to {} {:>9} {}",
|
||||||
start_time, stop_time, display_text
|
start_time, stop_time, duration_str, display_text
|
||||||
);
|
);
|
||||||
|
|
||||||
lines.push(line_text);
|
lines.push(line_text);
|
||||||
|
|
@ -736,6 +746,16 @@ impl App {
|
||||||
let start_time = format!("{:02}:{:02}", start_local.hour(), start_local.minute());
|
let start_time = format!("{:02}:{:02}", start_local.hour(), start_local.minute());
|
||||||
let stop_time = format!("{:02}:{:02}", stop_local.hour(), stop_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() {
|
let tags_str = if frame.tags.is_empty() {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -743,8 +763,8 @@ impl App {
|
||||||
};
|
};
|
||||||
|
|
||||||
lines.push(format!(
|
lines.push(format!(
|
||||||
"\t\t{} to {}{}",
|
"\t\t{} to {} {:>9}{}",
|
||||||
start_time, stop_time, tags_str
|
start_time, stop_time, duration_str, tags_str
|
||||||
));
|
));
|
||||||
frame_indices.push(*idx);
|
frame_indices.push(*idx);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue