adjustments for the other format cases

This commit is contained in:
Abraham Toriz 2021-06-25 13:56:48 -05:00
parent 950adfbe44
commit caf7f900f8
No known key found for this signature in database
GPG Key ID: D5B4A746DB5DD42A
1 changed files with 23 additions and 23 deletions

View File

@ -131,7 +131,7 @@ impl Formatter {
lpad(" ", 3.max(lengths[0])),
rpad("Day", 18),
rpad("Start", 10),
rpad("End", 8.max(lengths[3])),
rpad("End", 10.max(lengths[3])),
rpad("Duration", 8.max(lengths[4])),
"Notes",
)?;
@ -143,8 +143,8 @@ impl Formatter {
lpad(&id, 3.max(lengths[0])),
rpad(&date, 18),
rpad(&start, 10),
rpad(&end, 8.max(lengths[3])),
lpad(&duration, lengths[4]),
rpad(&end, 10.max(lengths[3])),
lpad(&duration, 8.max(lengths[4])),
note,
)?;
}
@ -154,7 +154,7 @@ impl Formatter {
lpad(" ", 3.max(lengths[0])),
"-".repeat(18),
"-".repeat(10),
"-".repeat(8.max(lengths[3])),
"-".repeat(10.max(lengths[3])),
"-".repeat(8.max(lengths[4])),
"-".repeat(4.max(lengths[5])),
)?;
@ -163,8 +163,8 @@ impl Formatter {
lpad(" ", 3.max(lengths[0])),
rpad("Total", 18),
rpad("", 10),
rpad("", 8.max(lengths[3])),
rpad(&format_duration(total), 8.max(lengths[4])),
rpad("", 10.max(lengths[3])),
lpad(&format_duration(total), 8.max(lengths[4])),
)?;
}
@ -217,18 +217,18 @@ mod tests {
let now = Utc.ymd(2008, 10, 5).and_hms(20, 0, 0);
let offset = Utc;
formatter.print_formatted(entries, &mut output, now, offset).unwrap();
formatter.print_formatted(entries, &mut output, now, offset, false).unwrap();
assert_eq!(PrettyString(&String::from_utf8_lossy(&output)), PrettyString("Timesheet: default
Day Start End Duration Notes
Fri Oct 03, 2008 12:00:00 - 14:00:00 2:00:00 entry 1
16:00:00 - 18:00:00 2:00:00 entry 2
4:00:00
Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 entry 3
18:00:00 - 2:00:00 entry 4
4:00:00
-----------------------------------------------------------
Total 8:00:00
Day Start End Duration Notes
Fri Oct 03, 2008 12:00:00 - 14:00:00 2:00:00 entry 1
16:00:00 - 18:00:00 2:00:00 entry 2
4:00:00
Sun Oct 05, 2008 16:00:00 - 18:00:00 2:00:00 entry 3
18:00:00 - 2:00:00 entry 4
4:00:00
---------------------------------------------------------
Total 8:00:00
"));
}
@ -243,14 +243,14 @@ mod tests {
let now = Utc.ymd(2008, 10, 5).and_hms(20, 0, 0);
let offset = Utc;
formatter.print_formatted(entries, &mut output, now, offset).unwrap();
formatter.print_formatted(entries, &mut output, now, offset, false).unwrap();
assert_eq!(PrettyString(&String::from_utf8_lossy(&output)), PrettyString("Timesheet: default
Day Start End Duration Notes
Fri Oct 03, 2008 12:00:00 - 14:00:00 1:59:59 entry 1
1:59:59
-----------------------------------------------------------
Total 1:59:59
Day Start End Duration Notes
Fri Oct 03, 2008 12:00:00 - 14:00:00 1:59:59 entry 1
1:59:59
---------------------------------------------------------
Total 1:59:59
"));
}
@ -266,7 +266,7 @@ mod tests {
let now = Utc.ymd(2008, 10, 5).and_hms(20, 0, 0);
let offset = Utc;
formatter.print_formatted(entries, &mut output, now, offset).unwrap();
formatter.print_formatted(entries, &mut output, now, offset, false).unwrap();
assert_eq!(PrettyString(&String::from_utf8_lossy(&output)), PrettyString("Timesheet: default
Day Start End Duration Notes