From cba4818e94535419121cd1c9dc15f1832b662db8 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Sat, 15 Mar 2025 20:13:31 +0100 Subject: Dual simulation (only i1 + full) --- front/src/Main.elm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'front/src') 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) ] ] -- cgit v1.2.3