Matchplan/flaskapp/blueprints/index.py

23 lines
828 B
Python
Raw Normal View History

2021-05-08 05:29:32 +02:00
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')