Ejemplo n.º 1
0
def execute(service, request):
    LOGGER.info('submit_bus_choice.execute() called.')

    route_id = request.route_id
    stop_id_from = request.stop_id_from
    stop_id_to = request.stop_id_to
    
    if not proto_utils.is_route_id_valid(route_id):
        return Response(
            is_success=False,
            status_message="Route id '%s' not found" % route_id
            )
    if not proto_utils.is_stop_id_valid(strop_id_from):
        return Response(
               is_success=False,
               status_message="Stop id '%s' not found for 'I joined at' field" % stop_id_from
            )
    if not proto_utils.is_stop_id_valid(strop_id_to):
        return Response(
               is_success=False,
               status_message="Stop id '%s' not found for 'I am going to' field" % stop_id_to
               )
    convert_request_to_passenger_bus_choice(request).put()
    
    return Response(is_success=True)
Ejemplo n.º 2
0
def execute_with_user(service, request, user_id):
    LOGGER.info('submit_incident.execute() called.')

    route_id = request.route_id

    if not proto_utils.is_route_id_valid(route_id):
        return Response(
            is_success=False,
            status_message="Route id '%s' not found" % route_id)

    convert_request_to_passenger_trip_rating(request, user_id).put()

    return Response(is_success=True)