mirror of
https://github.com/idanoo/NZCovidBot
synced 2025-07-03 04:02:14 +00:00
standardize macrons
This commit is contained in:
parent
28c8a31643
commit
07d0e82dff
3 changed files with 15 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue