mirror of
https://github.com/idanoo/NZCovidBot
synced 2025-07-02 03:32:14 +00:00
standardize macrons
This commit is contained in:
parent
28c8a31643
commit
07d0e82dff
3 changed files with 15 additions and 2 deletions
|
@ -15,3 +15,4 @@ build-go:
|
||||||
expire_in: 1 month
|
expire_in: 1 month
|
||||||
paths:
|
paths:
|
||||||
- nzcovidbot
|
- nzcovidbot
|
||||||
|
app
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
# 1.3
|
# 1.3
|
||||||
- Omicron related ones will post with an asterisk to indicate
|
- Omicron related ones will post with an asterisk to indicate
|
||||||
|
- Group different spelling locations together
|
||||||
|
|
||||||
## 1.2
|
## 1.2
|
||||||
- Change lastUpdated to pointer reference and use built in .After() functions
|
- Change lastUpdated to pointer reference and use built in .After() functions
|
||||||
|
|
|
@ -102,7 +102,8 @@ func getNewAPILocations() {
|
||||||
if strings.Contains(strings.ToLower(item.PublicAdvice), "omicron") {
|
if strings.Contains(strings.ToLower(item.PublicAdvice), "omicron") {
|
||||||
copy.EventName = copy.EventName + " (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
|
// Always keep the latest
|
||||||
if item.PublishedAt.After(newUpdatedTime) {
|
if item.PublishedAt.After(newUpdatedTime) {
|
||||||
|
@ -113,7 +114,8 @@ func getNewAPILocations() {
|
||||||
copy := item
|
copy := item
|
||||||
// Apend Omicron if Omicron in advice
|
// Apend Omicron if Omicron in advice
|
||||||
copy.EventName = copy.EventName + " (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
|
// Always keep the latest
|
||||||
if item.UpdatedAt.After(newUpdatedTime) {
|
if item.UpdatedAt.After(newUpdatedTime) {
|
||||||
|
@ -198,3 +200,12 @@ func getDaySuffix(t time.Time) string {
|
||||||
}
|
}
|
||||||
return suffix
|
return suffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseCity(c string) string {
|
||||||
|
switch city := c; city {
|
||||||
|
case "Whangarei":
|
||||||
|
return "Whangārei"
|
||||||
|
default:
|
||||||
|
return city
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue