Beispiel #1
0
def calculate():
    if request.method == 'POST':
        place_name = request.form['place_name']
        stop, distance = find_stop_near(place_name)
        return render_template('result.html', stop=stop, distance=distance)
    else:
        return render_template('index.html', error=None)
Beispiel #2
0
def find():
    if request.method == 'POST':
        place_name = request.form['place']
        stop, distance = find_stop_near(place_name)

        if stop:
            return render_template('Form results.html',
                                   nearest_station=stop,
                                   distance=distance)
        else:
            return render_template('index.html')
    return render_template('index.html')
Beispiel #3
0
def calculate():
    if request.method == 'POST':
        location = request.form['a']
        stop, dist = find_stop_near(location)
        if stop:
            return render_template('MBTA_result.html',
                                   a=location,
                                   s=stop,
                                   d=dist)
        else:
            return render_template('MBTA_form.html')
    return render_template('MBTA_form.html')
Beispiel #4
0
def calculate():
    if request.method == 'POST':
        location = request.form['a']
        stop, distance = find_stop_near(location)

        if stop:
            return render_template('calculator_result.html',
                                   s=stop,
                                   d=distance)
        else:
            return render_template('calculator_form.html', error=True)
    return render_template('calculator_form.html', error=None)
Beispiel #5
0
def calculate():
    if request.method == 'POST':
        a = request.form['a']

        root_1, root_2 = find_stop_near(a)

        if root_1:
            return render_template('Result.html',
                                   a=a,
                                   root_1=root_1,
                                   root_2=root_2)
        else:
            return render_template('form.html', error=True)
    return render_template('form.html', error=None)