1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

website stuff

This commit is contained in:
Steffo 2017-10-13 09:39:27 +02:00
parent 0425721103
commit 8a7e6d34fd
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D
4 changed files with 155 additions and 52 deletions

View file

@ -3,27 +3,21 @@ from flask import Flask, render_template
app = Flask(__name__)
@app.route("/dota/ladder")
@app.route("/ladder")
def page_dota_ladder():
session = db.Session()
query = session.execute("SELECT royals.username, dota.solo_mmr, dota.party_mmr, dota.wins FROM royals JOIN steam ON royals.id = steam.royal_id JOIN dota ON steam.steam_id = dota.steam_id ORDER BY dota.solo_mmr DESC;")
return render_template("table.htm", query=query)
@app.route("/rl/ladder")
def page_rl_ladder():
session = db.Session()
query = session.execute("SELECT royals.username, rocketleague.single_mmr, rocketleague.doubles_mmr, rocketleague.standard_mmr, rocketleague.solo_std_mmr FROM royals JOIN steam ON royals.id = steam.royal_id JOIN rocketleague ON steam.steam_id = rocketleague.steam_id ORDER BY rocketleague.doubles_mmr DESC;")
return render_template("table.htm", query=query)
@app.route("/osu/ladder")
def page_osu_ladder():
session = db.Session()
query = session.execute("SELECT royals.username, osu.std_pp, osu.taiko_pp, osu.catch_pp, osu.mania_pp FROM royals JOIN osu ON royals.id = osu.royal_id ORDER BY osu.std_pp DESC;")
return render_template("table.htm", query=query)
dota = session.execute("SELECT royals.username, dota.solo_mmr, dota.party_mmr, dota.wins FROM royals JOIN steam ON royals.id = steam.royal_id JOIN dota ON steam.steam_id = dota.steam_id ORDER BY dota.solo_mmr DESC;")
rl = session.execute("SELECT royals.username, "
"rocketleague.single_rank, rocketleague.single_div, rocketleague.single_mmr, "
"rocketleague.doubles_rank, rocketleague.doubles_div, rocketleague.doubles_mmr, "
"rocketleague.standard_rank, rocketleague.standard_div, rocketleague.standard_mmr, "
"rocketleague.solo_std_rank, rocketleague.solo_std_div, rocketleague.solo_std_mmr "
"FROM royals JOIN steam ON royals.id = steam.royal_id "
"JOIN rocketleague ON steam.steam_id = rocketleague.steam_id "
"ORDER BY rocketleague.doubles_rank DESC;")
osu = session.execute("SELECT royals.username, osu.std_pp, osu.taiko_pp, osu.catch_pp, osu.mania_pp FROM royals JOIN osu ON royals.id = osu.royal_id ORDER BY osu.std_pp DESC;")
return render_template("main.htm", dota=dota, rl=rl, osu=osu)
if __name__ == "__main__":
app.run()
app.run(host="0.0.0.0", port=1234)

51
templates/main.htm Normal file
View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Ladders</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<style>
body {
background-color: black;
color: white;
}
.table * * {
border-color: #333333 !important;
}
.rl-rank {
height: 48px;
}
.rl-name {
height: 48px;
line-height: 48px;
}
</style>
</head>
<body>
<div class="containter-fluid">
<h1>
Dota 2
</h1>
{% with query=dota %}
{% include 'table.htm' %}
{% endwith %}
<h1>
Rocket League
</h1>
{% with query=rl %}
{% include 'rl_table.htm' %}
{% endwith %}
<h1>
Osu!
</h1>
{% with query=osu %}
{% include 'table.htm' %}
{% endwith %}
</div>
</body>
</html>

70
templates/rl_table.htm Normal file
View file

@ -0,0 +1,70 @@
<table class="table">
<thead>
<tr>
<th>
Username
</th>
<th>
Singolo <small>1v1</small>
</th>
<th>
Doppio <small>2v2</small>
</th>
<th>
Standard <small>3v3</small>
</th>
<th>
Solo Standard <small>Solo 3v3</small>
</th>
</tr>
</thead>
<tbody>
{% for record in query %}
<tr>
<td class="rl-name">
{{ record[0] }}
</td>
<td>
{% if record[1] %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{{ record[1] }}.png">
<span class="rl-mmr">
{{ record[3] }}
</span>
{% else %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/0.png">
{% endif %}
</td>
<td>
{% if record[4] %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{{ record[4] }}.png">
<span class="rl-mmr">
{{ record[6] }}
</span>
{% else %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/0.png">
{% endif %}
</td>
<td>
{% if record[7] %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{{ record[7] }}.png">
<span class="rl-mmr">
{{ record[9] }}
</span>
{% else %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/0.png">
{% endif %}
</td>
<td>
{% if record[10] %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/{{ record[10] }}.png">
<span class="rl-mmr">
{{ record[12] }}
</span>
{% else %}
<img class="rl-rank" src="https://rocketleaguestats.com/assets/img/rocket_league/ranked/season_four/0.png">
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -1,36 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Ladder</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
</head>
<body>
<table class="table">
<thead>
<table class="table">
<thead>
<tr>
{% for column in query.keys() %}
<th>
{{ column }}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for record in query %}
<tr>
{% for column in query.keys() %}
<th>
{{ column }}
</th>
{% for column in record %}
<td>
{% if column %}
{{ column }}
{% endif %}
</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for record in query %}
<tr>
{% for column in record %}
<td>
{% if column %}
{{ column }}
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>
{% endfor %}
</tbody>
</table>