23 lines
828 B
Python
23 lines
828 B
Python
|
from flask import Blueprint, render_template
|
||
|
from flaskapp.lib.login import check_is_logged_in
|
||
|
from flaskapp.lib.toornament import get_toornament
|
||
|
|
||
|
bp = Blueprint('index', __name__)
|
||
|
|
||
|
|
||
|
@bp.route('/')
|
||
|
def index():
|
||
|
if check_is_logged_in():
|
||
|
toornament = get_toornament()
|
||
|
participations = toornament.get_participation_data()
|
||
|
tournaments = list()
|
||
|
for participation in participations:
|
||
|
tournament = toornament.get_tournament(participation['tournament_id'])
|
||
|
if tournament['discipline'] != 'leagueoflegends':
|
||
|
continue
|
||
|
tournament['participant_id'] = participation['id']
|
||
|
tournaments.append(tournament)
|
||
|
tournaments.reverse()
|
||
|
return render_template('home.html', tournaments=tournaments)
|
||
|
return render_template('home.html')
|