File size: 1,469 Bytes
45dfbda
 
 
 
 
 
 
 
 
3bff109
 
 
 
 
45dfbda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29004d8
9f24e32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from flask import Flask, render_template, request
from live_scoring import get_live_scores
from scorecard import get_scorecard
from leaderboards import get_leaderboards
from tournament_organizer import organize_tournament
from looking import lookup_player_team_umpire

app = Flask(__name__)

@app.route('/test')
def test():
    return "App is running!"


@app.route('/')
def home():
    return render_template('index.html')

@app.route('/live_scoring', methods=['GET'])
def live_scoring():
    scores = get_live_scores()
    return render_template('live_scoring.html', scores=scores)

@app.route('/scorecard', methods=['GET'])
def scorecard():
    player_scores = get_scorecard()
    return render_template('scorecard.html', player_scores=player_scores)

@app.route('/leaderboards', methods=['GET'])
def leaderboards():
    rankings = get_leaderboards()
    return render_template('leaderboards.html', rankings=rankings)

@app.route('/tournament', methods=['GET', 'POST'])
def tournament():
    if request.method == 'POST':
        tournament_details = request.form
        organize_tournament(tournament_details)
    return render_template('tournament_organizer.html')

@app.route('/lookup', methods=['GET'])
def lookup():
    query = request.args.get('query')
    result = lookup_player_team_umpire(query)
    return render_template('lookup.html', result=result)

if __name__ == '__main__':
    app.run(debug=True, host='127.0.0.1', port=5001)  # Custom port number