예제 #1
0
 def test_gets_user_stop_id(self):
     user_lat = 37.785152
     user_lon = -122.406581
     route_code = '153'
     route = gets_route_id_db(route_code)
     self.assertEqual(gets_user_stop_id(user_lat, user_lon, route), 14)
     print "complete gets_user_stop_id"
예제 #2
0
 def test_gets_user_stop_id(self):
     user_lat = 37.785152
     user_lon = -122.406581
     route_code = '153'
     route = gets_route_id_db(route_code)
     self.assertEqual(gets_user_stop_id(user_lat, user_lon, route), 14)
     print "complete gets_user_stop_id"
예제 #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)