diff options
author | Guillermo Ramos | 2025-03-15 20:13:31 +0100 |
---|---|---|
committer | Guillermo Ramos | 2025-03-15 20:52:39 +0100 |
commit | cba4818e94535419121cd1c9dc15f1832b662db8 (patch) | |
tree | 2368b30a05818c251d8b20ddfd4002770c88f482 /front/src | |
parent | f5e64310fe3f4a174f8f966edc1f9cc09af4639e (diff) | |
download | hiccup-cba4818e94535419121cd1c9dc15f1832b662db8.tar.gz |
Dual simulation (only i1 + full)
Diffstat (limited to 'front/src')
-rw-r--r-- | front/src/Main.elm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/front/src/Main.elm b/front/src/Main.elm index fef4863..68ead13 100644 --- a/front/src/Main.elm +++ b/front/src/Main.elm @@ -206,7 +206,8 @@ capitalSumView { t, settings } { principal, interest } = type alias MortgageSim = { updates : SimUpdates , history : List Quota - , topay : Capital + , payed_noupdates : Capital + , payed_noprepays : Capital , payed : Capital , payed_amortized : Float } @@ -214,10 +215,11 @@ type alias MortgageSim = simDecoder : JD.Decoder MortgageSim simDecoder = - JD.map5 MortgageSim + JD.map6 MortgageSim (JD.field "updates" simUpdatesDecoder) (JD.field "history" (JD.list quotaDecoder)) - (JD.field "topay" capitalDecoder) + (JD.field "payed_noupdates" capitalDecoder) + (JD.field "payed_noprepays" capitalDecoder) (JD.field "payed" capitalDecoder) (JD.field "payed_amortized" JD.float) @@ -1225,8 +1227,8 @@ simView m ( rawSpecs, sim ) = , amountView [] currency vat ] ] - , overview (t "Total to pay: ") sim.topay [] - , if capitalSumView m sim.topay /= capitalSumView m sim.payed then + , overview (t "Total to pay: ") sim.payed_noprepays [] + , if sim.payed_amortized > 0 then overview (t "Total after early payments: ") sim.payed <| [ li [] [ text <| t "Payed early: " @@ -1234,7 +1236,7 @@ simView m ( rawSpecs, sim ) = ] , li [] [ text <| t "Saved: " - , amountView [] currency (sim.topay.interest - sim.payed.interest) + , amountView [] currency (sim.payed_noprepays.interest - sim.payed.interest) ] ] |