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,20 +101,15 @@ func getNewAPILocations() {
|
||||||
// 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)
|
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) {
|
} else if item.PublishedAt.After(previousUpdatedTime) {
|
||||||
// Clone the item to put in our own lil slice
|
// Clone the item to put in our own lil slice
|
||||||
copy := item
|
copy := item
|
||||||
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
|
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
|
||||||
|
}
|
||||||
|
|
||||||
// Always keep the latest
|
// Always keep the latest
|
||||||
if item.PublishedAt.After(newUpdatedTime) {
|
if item.PublishedAt.After(newUpdatedTime) {
|
||||||
newUpdatedTime = item.PublishedAt
|
newUpdatedTime = item.PublishedAt
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue