forked from paul/sinoptik
Fix valid samples/items being discarded too early
A forecasted sample/item may be for example timestamped at 14:00. For hourly forecasts, it will still be valid until 14:59:59, not 14:29:59.
This commit is contained in:
parent
b61eb63cdf
commit
ab4b0bba72
|
@ -50,10 +50,10 @@ fn merge(
|
|||
let mut pollen_samples = pollen_samples;
|
||||
let mut aqi_items = aqi_items;
|
||||
|
||||
// Only retain samples/items that have timestamps that are at least half an hour ago.
|
||||
// Only retain samples/items that have timestamps that are at least an hour ago.
|
||||
let now = Utc::now();
|
||||
pollen_samples.retain(|smp| smp.time.signed_duration_since(now).num_seconds() > -1800);
|
||||
aqi_items.retain(|item| item.time.signed_duration_since(now).num_seconds() > -1800);
|
||||
pollen_samples.retain(|smp| smp.time.signed_duration_since(now).num_seconds() > -3600);
|
||||
aqi_items.retain(|item| item.time.signed_duration_since(now).num_seconds() > -3600);
|
||||
|
||||
// Align the iterators based on the (hourly) timestamps!
|
||||
let pollen_first_time = pollen_samples.first()?.time;
|
||||
|
|
Loading…
Reference in New Issue