though timestamps may include hours, always sum by day

main
Bel LaPointe 2024-08-27 08:21:43 -06:00
parent f9f3fa5212
commit d9f84022a0
1 changed files with 4 additions and 1 deletions

View File

@ -102,12 +102,13 @@ fn log(f: &String, enabled: &bool, since: &Option<String>, verbose: &bool, preci
let mut result = vec![];
let mut curr = Log{t: "".to_string(), d: 0.0, xs: vec![]};
let mut currt = "".to_string();
for i in 0..tsheet.xs.len() {
let x = &tsheet.xs[i];
if *verbose {
eprintln!("{} != {}?", &curr.t, x.timestamp(&precision));
}
if curr.t != x.timestamp(&precision) {
if currt != x.timestamp(&0) {
if curr.xs.len() > 0 {
if *verbose {
eprintln!("push {:?}", &curr.xs);
@ -116,6 +117,7 @@ fn log(f: &String, enabled: &bool, since: &Option<String>, verbose: &bool, preci
}
curr.xs.truncate(0);
curr.t = x.timestamp(&precision);
currt = x.timestamp(&0);
curr.d = 0.0;
}
let mut d = 1.0;
@ -131,6 +133,7 @@ fn log(f: &String, enabled: &bool, since: &Option<String>, verbose: &bool, preci
0 => {},
_ => {
curr.t = x.timestamp(&precision);
currt = x.timestamp(&0);
curr.xs.push(LogX{d: d, x: x.x.clone()});
},
};