Skip to content
Snippets Groups Projects
Commit 6c45dfcc authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Small fixes to last commits

parent 55d770ca
No related branches found
No related tags found
No related merge requests found
......@@ -388,6 +388,7 @@ class Nextbus():
if not vehicles:
continue
for vehicle in vehicles:
route = next((r for r in routes if r.tag == vehicle.get('routeTag')), None)
# Convert age in seconds to a DateTime
age = timedelta(seconds=int(vehicle.get('secsSinceReport')))
time = datetime.now() - age
......@@ -431,7 +432,7 @@ class Nextbus():
"""
expire = datetime.now() - timedelta(seconds=app.config['LOCATIONS_MAX_AGE'])
delete = db.session.query(Prediction)\
.filter(VehicleLocation.created < expire)\
.filter(VehicleLocation.time < expire)\
.delete()
return delete
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment