eprint hours sum
parent
181cfc1454
commit
24621725ca
13
src/main.rs
13
src/main.rs
|
|
@ -143,15 +143,17 @@ fn log(f: &String, enabled: &bool, since: &Option<String>, verbose: &bool, preci
|
||||||
}
|
}
|
||||||
result.push(curr.clone());
|
result.push(curr.clone());
|
||||||
}
|
}
|
||||||
|
let mut total_d = 0.0;
|
||||||
for i in result.iter_mut() {
|
for i in result.iter_mut() {
|
||||||
i.d = i.xs.iter().map(|x| x.d).sum();
|
i.d = i.xs.iter().map(|x| x.d).sum();
|
||||||
|
total_d += i.d;
|
||||||
if *verbose {
|
if *verbose {
|
||||||
eprintln!("{} = {:?}", &i.d, &i.xs.iter().map(|x| x.d).collect::<Vec<_>>());
|
eprintln!("{} = {:?}", &i.d, &i.xs.iter().map(|x| x.d).collect::<Vec<_>>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for log in result {
|
for log in &result {
|
||||||
for x in log.xs {
|
for x in log.xs.clone() {
|
||||||
if x.x.len() > 0 {
|
if x.x.len() > 0 {
|
||||||
match precision {
|
match precision {
|
||||||
0 => println!("{} ({:.0}) {} ({:.1})", log.t, log.d, x.x, x.d),
|
0 => println!("{} ({:.0}) {} ({:.1})", log.t, log.d, x.x, x.d),
|
||||||
|
|
@ -161,6 +163,13 @@ fn log(f: &String, enabled: &bool, since: &Option<String>, verbose: &bool, preci
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match precision {
|
||||||
|
0 => eprintln!("({:.0}h over {} dates)", total_d, result.len()),
|
||||||
|
1 => eprintln!("({:.1}h over {} dates)", total_d, result.len()),
|
||||||
|
_ => eprintln!("({:.2}h over {} dates)", total_d, result.len()),
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue