From 67479195e200d32c99c6ee58e679a52033fb3505 Mon Sep 17 00:00:00 2001
From: Immanuel Onyeka <immanuel@debian-BULLSEYE-live-builder-AMD64>
Date: Tue, 5 Dec 2023 16:33:28 -0500
Subject: [PATCH] Fix monthly MI calculation

---
 components/new/summary.vue | 3 ---
 skouter.go                 | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/components/new/summary.vue b/components/new/summary.vue
index 70a28d3..0e26aea 100644
--- a/components/new/summary.vue
+++ b/components/new/summary.vue
@@ -80,7 +80,6 @@ function summarize() {
 	}).then(resp => {
 		if (resp.ok && resp.status == 200) return resp.json()
 	}).then(e => {
-	  console.log(e)
 	  emit('update', e)
 	})
 
@@ -100,8 +99,6 @@ function create() {
 		    saved.value = true
 		    return
 		} else {
-		    // resp.text().then(t => this.errors = [t])
-		    // window.location.hash = 'new'
 		    resp.text().then(t => console.log(t))
 		    saved.value = false
 	    }
diff --git a/skouter.go b/skouter.go
index a5be0e0..3e0400f 100644
--- a/skouter.go
+++ b/skouter.go
@@ -331,7 +331,7 @@ func (estimate *Estimate) makeResults() []Result {
 	
 	for i := range estimate.Loans {
 		var loan = &estimate.Loans[i]
-		var result Result
+		var result Result = Result{}
 		// Monthly payments use amortized loan payment formula plus monthly MI,
 		// plus all other recurring fees
 		result.LoanPayment = amortize(float64(loan.Amount),
@@ -340,7 +340,7 @@ func (estimate *Estimate) makeResults() []Result {
 		result.TotalMonthly = result.LoanPayment + loan.Hoi + loan.Tax + loan.Hazard
 		if loan.Mi.Monthly {
 			result.TotalMonthly = result.TotalMonthly +
-			int(loan.Mi.Rate/100*float32(loan.Amount))
+			int(loan.Mi.Rate/100/12*float32(loan.Amount))
 		}
 		
 		for i := range loan.Fees {