From 6e22a3c2a42fadf3c2ffe98b43d785c88fb9a20f Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Fri, 6 Jan 2023 23:46:29 -0500 Subject: [PATCH] Add dealer badge --- backend/app.go | 2 +- backend/model.go | 5 +++++ src/App.vue | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/app.go b/backend/app.go index ff270ec..67ca12f 100644 --- a/backend/app.go +++ b/backend/app.go @@ -91,7 +91,7 @@ func (a *App) listTopics(w http.ResponseWriter, r *http.Request) { } func (a *App) refreshTopics() { - latestTopics := a.getDeals(9, 1, 4) + latestTopics := a.getDeals(9, 1, 6) latestTopics = a.updateScores(latestTopics) log.Debug().Msg("Refreshing topics") a.CurrentTopics = latestTopics diff --git a/backend/model.go b/backend/model.go index c35b5aa..57f2b7f 100644 --- a/backend/model.go +++ b/backend/model.go @@ -14,6 +14,7 @@ type Topic struct { PostTime string `json:"post_time"` LastPostTime string `json:"last_post_time"` Votes Votes + Offer Offer Score int `json:"score"` } // @name Topic @@ -21,3 +22,7 @@ type Votes struct { Up int `json:"total_up"` Down int `json:"total_down"` } // @name Votes + +type Offer struct { + DealerName string `json:"dealer_name"` +} // @name Offer diff --git a/src/App.vue b/src/App.vue index 5fee605..6c059f7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -85,7 +85,7 @@ export default { }, filteredTopics() { return this.topics.filter((row) => { - const titles = row.title.toString().toLowerCase(); + const titles = (row.title.toString() + ' [' + row.Offer.dealer_name + ']').toLowerCase(); const searchTerm = this.filter.toLowerCase(); return titles.includes(searchTerm); @@ -154,7 +154,7 @@ export default {