Exemple #1
0
def handle_dispatch(request):
    customer_id = request.args.get('customer')
    return serializer.obj_to_json(eta.get_best_eta(customer_id))
Exemple #2
0
def handle_find_nearest(request):
    pickup = request.args.get('pickup')
    driver_ids = redis.find_drivers_ids(pickup=pickup)
    drivers = [redis.get_driver(_id) for _id in driver_ids]
    drivers = [serializer.obj_to_json(d) for d in drivers]
    return drivers
Exemple #3
0
def get_customer():
    customer_id = request.args.get('id')
    customer_obj = db.get_customer_by_id(customer_id)
    return jsonify(serializer.obj_to_json(customer_obj))
Exemple #4
0
def get_customer():
    customer_id = request.args.get('id')
    mutex_delay = request.args.get('mutex_delay', 0)
    customer_obj = db.get_customer_by_id(customer_id, float(mutex_delay))

    return jsonify(serializer.obj_to_json(customer_obj))
Exemple #5
0
def handle_route(request):
    pickup = request.args.get('pickup')
    dropoff = request.args.get('dropoff')
    return serializer.obj_to_json(compute_route(pickup, dropoff))