Exemple #1
0
    def setUp(self):
        """Creating mock data to test aganist"""

        user_db = User.query.filter_by(user_name="Jessica").first()
        user_inital_stop = '14'
        user_inital_stop = gets_stop_db(user_inital_stop)
        destination_stop = '32'
        destination_stop = gets_stop_db(destination_stop)
        route_code = '153'
        route = gets_route_id_db(route_code)
        agency = 'BART'
        arrival_time_datetime = datetime.datetime(2016, 7, 31, 4, 39, 53, 25840)

        adds_transit_request(user_inital_stop.stop_code, destination_stop.stop_code, agency,  route.name,  route.route_code,  arrival_time_datetime, user_db)
Exemple #2
0
    def setUp(self):
        """Creating mock data to test aganist"""

        user_db = User.query.filter_by(user_name="Jessica").first()
        user_inital_stop = '14'
        user_inital_stop = gets_stop_db(user_inital_stop)
        destination_stop = '32'
        destination_stop = gets_stop_db(destination_stop)
        route_code = '153'
        route = gets_route_id_db(route_code)
        agency = 'BART'
        arrival_time_datetime = datetime.datetime(2016, 7, 31, 4, 39, 53,
                                                  25840)

        adds_transit_request(user_inital_stop.stop_code,
                             destination_stop.stop_code, agency, route.name,
                             route.route_code, arrival_time_datetime, user_db)
Exemple #3
0
def process_user_info():
    """recieves the user data and processes data"""

    user_name = request.form.get("name")
    raw_user_phone_num = request.form.get("phone")
    agency = request.form.get("agency")
    route_code = request.form.get("route")
    user_inital_stop = request.form.get("user_stop")
    destination_stop = request.form.get("destination_stop")
    user_lat = request.form.get("lat")
    user_lon = request.form.get("lng")

    route = gets_route_id_db(route_code)

    if user_lat:
        user_inital_stop = gets_user_stop_id(user_lat, user_lon, route)

    user_inital_stop = gets_stop_db(user_inital_stop)

    if not user_lat:
        user_lat = user_inital_stop.lat
        user_lon = user_inital_stop.lon

    destination_stop = gets_stop_db(destination_stop)

    arrival_time_datetime = process_lat_lng_get_arrival_datetime(user_lat, user_lon,
                                                                destination_stop)

    user_phone = convert_to_e164(raw_user_phone_num)
    user_db = checks_user_db(user_name, user_phone)

    adds_transit_request(user_inital_stop.stop_code, destination_stop.stop_code,
                        agency, route.name, route.route_code, arrival_time_datetime,
                        user_db)

    return render_template("/thank_you.html",
                                            user_fname=user_name,
                                            user_phone=user_phone,
                                            route=route,
                                            user_inital_stop=user_inital_stop,
                                            destination_stop=destination_stop)