main
parent
8553a103d9
commit
cf831a2127
|
|
@ -65,7 +65,7 @@ def calcula_distancias_parada(redis_id, parada_id):
|
||||||
|
|
||||||
def estima_llegada(parada_distance, expedicion):
|
def estima_llegada(parada_distance, expedicion):
|
||||||
ts = int(time.time())
|
ts = int(time.time())
|
||||||
data_keys = ['trip_traveled', 'ppu', 'trip_lat', 'trip_lng', 'trip_pos', 'ts']
|
data_keys = ['trip_traveled', 'ppu', 'trip_lat', 'trip_lon', 'trip_pos', 'ts']
|
||||||
trip_info = dict(zip(data_keys, expedicion))
|
trip_info = dict(zip(data_keys, expedicion))
|
||||||
trip_info['drift'] = int(trip_info['ts']) - ts
|
trip_info['drift'] = int(trip_info['ts']) - ts
|
||||||
trip_info['trip_distance'] = parada_distance - int(trip_info['trip_traveled'])
|
trip_info['trip_distance'] = parada_distance - int(trip_info['trip_traveled'])
|
||||||
|
|
@ -89,7 +89,7 @@ def estima_llegada(parada_distance, expedicion):
|
||||||
elif estimator > 0: #
|
elif estimator > 0: #
|
||||||
trip_info['trip_estimator'] = 'En parada'
|
trip_info['trip_estimator'] = 'En parada'
|
||||||
else: #
|
else: #
|
||||||
salida = math.ceil(estimator/60)
|
salida = math.ceil(-estimator/60)
|
||||||
trip_info['trip_estimator'] = 'Hace {} minutos'.format(salida)
|
trip_info['trip_estimator'] = 'Hace {} minutos'.format(salida)
|
||||||
|
|
||||||
return trip_info
|
return trip_info
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue