Cibles evenementielles locales, abstention relative et dates strictement passees
This commit is contained in:
@@ -23,7 +23,7 @@ def states_for(fuel):
|
||||
for r in storage.price_journal(fuel, "2007-01-01", date.today().isoformat()):
|
||||
if storage.distance_km(44.7737872, -0.5595029, r["lat"], r["lon"]) > 15:
|
||||
continue
|
||||
if r["price"] is not None:
|
||||
if r["price"] is not None and storage.observation_not_future(r.get("source_updated") or r["day"]):
|
||||
events.setdefault(r["day"], []).append(r)
|
||||
if not events:
|
||||
return {}
|
||||
@@ -40,9 +40,10 @@ def states_for(fuel):
|
||||
return states
|
||||
|
||||
|
||||
def feature_rows(states):
|
||||
def feature_rows(states, as_of=None):
|
||||
# Ce filtre précède tout calcul. Aucun label n'existe à cette étape.
|
||||
points = list(states.values())
|
||||
as_of = as_of or date.today().isoformat()
|
||||
points = [p for p in states.values() if p["available_at"] <= as_of and p["day"] <= as_of]
|
||||
result = {}
|
||||
for i, p in enumerate(points):
|
||||
if len(p["prices"]) < 3 or i < 90:
|
||||
|
||||
Reference in New Issue
Block a user