Browse Source

Fix estimate_results SQL error

master
Immanuel Onyeka 1 year ago
parent
commit
a2b2ca2ca2
3 changed files with 12 additions and 8 deletions
  1. +1
    -1
      assets/main.css
  2. +3
    -2
      components/estimates.vue
  3. +8
    -5
      skouter.go

+ 1
- 1
assets/main.css View File

@@ -387,7 +387,7 @@ section.mi .row input[type=checkbox] {

section.estimates .entry {
padding: 10px 3px;
border: 2px solid var(--outline);
border-bottom: 2px solid var(--outline);
border-radius: 3px;
}



+ 3
- 2
components/estimates.vue View File

@@ -32,8 +32,9 @@
<section class="inputs estimates">
<h3>Saved Estimates</h3>

<div class="entry" v-for="e in estimates" v-if="!estimate">
<span @click="() => estimate = e">
<div class="entry" v-for="e in estimates" v-if="!estimate"
@click="() => estimate = e">
<span>
{{e.id}} - {{e.property}} - ${{(e.price/100).toLocaleString()}}
</span>
</div>


+ 8
- 5
skouter.go View File

@@ -96,7 +96,7 @@ type Loan struct {
Dti float32 `json:"dti"`
Hoi int `json:"hoi"`
Hazard int `json:"hazard"`
Tax int `json:"hoi"`
Tax int `json:"tax"`
Interest float32 `json:"interest"`
Mi MI `json:"mi"`
Fees []Fee `json:"fees"`
@@ -915,15 +915,18 @@ func getResults(db *sql.DB, e int, id int) ( []Result, error ) {
var err error

query = `SELECT
id,
r.id,
loan_id,
loan_payment,
total_monthly,
total_fees,
total_credits,
cash_to_close,
FROM estimate_result WHERE id = CASE @e := ? WHEN 0 THEN id ELSE @e END AND
loan_id = ( SELECT id FROM loan WHERE loan.estimate_id = ? )
cash_to_close
FROM estimate_result r
INNER JOIN loan
ON r.loan_id = loan.id
WHERE r.id = CASE @e := ? WHEN 0 THEN r.id ELSE @e END
AND loan.estimate_id = ?
`
rows, err = db.Query(query, id, e)



Loading…
Cancel
Save