split table at half-years
This commit is contained in:
parent
83e9219049
commit
35541de631
13
src/main.rs
13
src/main.rs
|
@ -163,9 +163,20 @@ fn main() {
|
|||
);
|
||||
|
||||
table.set_titles(row!["Jahr", "Einzahler", "Zahlungen", "Summe"]);
|
||||
|
||||
let mut prev_yuhj = Option::<String>::None;
|
||||
for (k, v) in accu.iter_mut() {
|
||||
let yearuhj = format!("{} {}", k.0, if k.1 { "II" } else { "I" });
|
||||
let mut yearuhj = format!("{} {}", k.0, if k.1 { "II" } else { "I" });
|
||||
let is_ny = prev_yuhj.as_ref().map(|i| i != &yearuhj);
|
||||
if is_ny.unwrap_or(false) {
|
||||
table.add_row(row!["", "", "", ""]);
|
||||
}
|
||||
v.2 += &std::iter::repeat(' ').take(pdsp - v.3).collect::<String>();
|
||||
if is_ny.unwrap_or(true) {
|
||||
prev_yuhj = Some(yearuhj.clone());
|
||||
} else {
|
||||
yearuhj.clear();
|
||||
}
|
||||
table.add_row(if highlight.contains(&*k.2) {
|
||||
row![yearuhj, FYBdb-> k.2, r-> v.0.to_string(), Fgbr-> v.2]
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue