fuzzyworld

find-stone-beer / commit

Replace some long names with shortened forms. This adds a few more results to the notification.

aba75e09761be2abfef5b1a631d268d47feb1228 · Pavel Safronov · 2023-08-26 23:59:42 -0700 · parents e700fcc64ae3

Replace some long names with shortened forms. This adds a few more results to the notification.
 main.go              | 4 ++++
 name-replacements.go | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/main.go b/main.go
index d5c2727..45046fe 100644
--- a/main.go
+++ b/main.go
@@ -111,6 +111,10 @@ func main() {
 				continue
 			}
 			mapsLink := getGoogleMapsLink(seller.Pos)
+			replacement, hasReplacement := NameReplacements[seller.Title]
+			if hasReplacement {
+				seller.Title = replacement
+			}
 			message := fmt.Sprintf("<a href='%s'>%s (%.1fm)</a> - %d days\n", mapsLink, seller.Title, dist, daysSinceDelivery)
 
 			relevantSellers = append(relevantSellers, relevantSeller{
diff --git a/name-replacements.go b/name-replacements.go
new file mode 100644
index 0000000..231fa79
--- /dev/null
+++ b/name-replacements.go
@@ -0,0 +1,7 @@
+package main
+
+var NameReplacements = map[string]string{
+	"Quality Food Center Fresh Fare": "QFC",
+	"Quality Food Center":            "QFC",
+	"Whole Foods Market":             "Whole Foods",
+}