2017-10-25 09:09:06 +00:00
|
|
|
from flask import Flask, render_template
|
2017-11-11 17:55:13 +00:00
|
|
|
from db import Session, Royal, Steam, RocketLeague, Dota, Osu, Overwatch, LeagueOfLegends
|
2017-10-30 09:46:37 +00:00
|
|
|
from sqlalchemy.orm import joinedload
|
2017-11-07 17:44:00 +00:00
|
|
|
from sqlalchemy import func
|
2017-10-25 09:09:06 +00:00
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
app.jinja_env.trim_blocks = True
|
|
|
|
app.jinja_env.lstrip_blocks = True
|
|
|
|
|
|
|
|
@app.route("/leaderboards")
|
|
|
|
def page_leaderboards():
|
2017-10-30 09:46:37 +00:00
|
|
|
session = Session()
|
|
|
|
dota_data = session.query(Dota).options(joinedload(Dota.steam).joinedload(Steam.royal)).join(Steam).join(Royal).all()
|
|
|
|
rl_data = session.query(RocketLeague).options(joinedload(RocketLeague.steam).joinedload(Steam.royal)).join(Steam).join(Royal).all()
|
|
|
|
ow_data = session.query(Overwatch).options(joinedload(Overwatch.royal)).join(Royal).all()
|
|
|
|
osu_data = session.query(Osu).options(joinedload(Osu.royal)).join(Royal).all()
|
|
|
|
lol_data = session.query(LeagueOfLegends).options(joinedload(LeagueOfLegends.royal)).join(Royal).all()
|
|
|
|
session.close()
|
2017-10-25 09:09:06 +00:00
|
|
|
return render_template("leaderboards.html", dota_data=dota_data, rl_data=rl_data, ow_data=ow_data, osu_data=osu_data, lol_data=lol_data)
|
|
|
|
|
2017-11-07 17:44:00 +00:00
|
|
|
|
2017-10-25 09:09:06 +00:00
|
|
|
if __name__ == "__main__":
|
2017-10-27 09:53:05 +00:00
|
|
|
try:
|
|
|
|
app.run(host="0.0.0.0", port=1234, debug=True)
|
|
|
|
except KeyboardInterrupt:
|
2017-10-30 09:46:37 +00:00
|
|
|
pass
|