mirror of
https://github.com/idanoo/NZCovidBot
synced 2025-07-02 03:32:14 +00:00
Keep latest event always
This commit is contained in:
parent
8423c83f2c
commit
51163b15e6
1 changed files with 4 additions and 9 deletions
|
@ -101,22 +101,17 @@ func getNewAPILocations() {
|
|||
// Apend Omicron if Omicron in advice
|
||||
copy.EventName = copy.EventName + " (Omicron)"
|
||||
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
|
||||
|
||||
// Always keep the latest
|
||||
if item.PublishedAt.After(newUpdatedTime) {
|
||||
newUpdatedTime = item.PublishedAt
|
||||
}
|
||||
} else if item.PublishedAt.After(previousUpdatedTime) {
|
||||
// Clone the item to put in our own lil slice
|
||||
copy := item
|
||||
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
|
||||
}
|
||||
|
||||
// Always keep the latest
|
||||
if item.PublishedAt.After(newUpdatedTime) {
|
||||
newUpdatedTime = item.PublishedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure to clear out the previous list and append new data in a map based on location
|
||||
newLocations = PostResponse{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue