diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-10-09 23:51:37 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-10-09 23:51:37 +0300 |
commit | c1d4b0a43046b8aa4bad6ebf6ca3f74aba1bb54f (patch) | |
tree | 4cc9f11cdee92b9d50cb2ff240c8d64d475fbe32 /src/main.rs | |
parent | 742b9fa46d74762f58ae939afd980a532cc4636f (diff) | |
download | finbudg-c1d4b0a43046b8aa4bad6ebf6ca3f74aba1bb54f.tar.gz finbudg-c1d4b0a43046b8aa4bad6ebf6ca3f74aba1bb54f.zip |
take into account shared expenses
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 5c64959..cd401e2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -181,6 +181,20 @@ fn output(account: Account, maybe_calculated: Option<Calculated>) { println!(); + for (n, owed) in calculated.total_owed.iter() { + println!( + "{} person(s) owe you in shared expenses: {:.2}", + n - 1, + owed, + ); + + if *n > 2 { + println!("Each owes you: {}", *owed / (*n as f64 - 1.0)); + } + + println!(); + } + println!("Days until balance runs out:"); let days_left_output = format!( @@ -192,6 +206,8 @@ fn output(account: Account, maybe_calculated: Option<Calculated>) { calculated.days_left_essential, ); + // TODO: also show much money would be left by the end of the period + let mut all_are_healthy = true; let mut essential_are_healthy = true; |