standardize macrons

This commit is contained in:
Daniel Mason 2022-01-17 16:25:26 +13:00
parent 28c8a31643
commit 07d0e82dff
3 changed files with 15 additions and 2 deletions

View file

@ -15,3 +15,4 @@ build-go:
expire_in: 1 month
paths:
- nzcovidbot
app

View file

@ -2,6 +2,7 @@
# 1.3
- Omicron related ones will post with an asterisk to indicate
- Group different spelling locations together
## 1.2
- Change lastUpdated to pointer reference and use built in .After() functions

View file

@ -102,7 +102,8 @@ func getNewAPILocations() {
if strings.Contains(strings.ToLower(item.PublicAdvice), "omicron") {
copy.EventName = copy.EventName + " (Omicron)"
}
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
locationParse := parseCity(item.Location.City)
newItems[locationParse] = append(newItems[locationParse], copy)
// Always keep the latest
if item.PublishedAt.After(newUpdatedTime) {
@ -113,7 +114,8 @@ func getNewAPILocations() {
copy := item
// Apend Omicron if Omicron in advice
copy.EventName = copy.EventName + " (Omicron)"
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
locationParse := parseCity(item.Location.City)
newItems[locationParse] = append(newItems[locationParse], copy)
// Always keep the latest
if item.UpdatedAt.After(newUpdatedTime) {
@ -198,3 +200,12 @@ func getDaySuffix(t time.Time) string {
}
return suffix
}
func parseCity(c string) string {
switch city := c; city {
case "Whangarei":
return "Whangārei"
default:
return city
}
}