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

Cose che mi sono dimenticato sul portatile

This commit is contained in:
Steffo 2018-06-07 11:47:04 +02:00
parent 080f53ccb0
commit 257448e7f9
5 changed files with 102 additions and 1 deletions

17
db.py
View file

@ -639,6 +639,23 @@ class Overwatch(Base):
self.level = j["prestige"] * 100 + j["level"]
self.rank = j["comprank"]
def rank_url(self):
if self.rank < 1500:
n = 1
elif self.rank < 2000:
n = 2
elif self.rank < 2500:
n = 3
elif self.rank < 3000:
n = 4
elif self.rank < 3500:
n = 5
elif self.rank < 4000:
n = 6
else:
n = 7
return f"https://d1u1mce87gyfbn.cloudfront.net/game/rank-icons/season-2/rank-{n}.png"
class Diario(Base):
__tablename__ = "diario"

View file

@ -351,6 +351,53 @@ input[type="text"], input[type="password"] {
}
}
.ow {
padding: 15px;
font-family: "Big Noodle Too", sans-serif;
font-style: italic;
background-color: #ffffff;
border: 2px solid #ff9c00;
grid-row-gap: 5px;
grid-template-columns: 25% 75%;
color: #ff9c00;
.player {
grid-row: 1;
grid-column-start: 1;
grid-column-end: 3;
.player-name {
font-size: x-large;
color: #ff9c00;
}
}
.game-score.level {
font-size: x-large;
}
.level {
grid-column: 1;
text-align: center;
}
.rank {
grid-column: 2;
grid-row-start: 2;
grid-row-end: 4;
margin-top: auto;
margin-bottom: auto;
img {
vertical-align: middle;
}
img.icon {
height: 60px;
}
}
}
#edit-css {
font-size: medium;
}

33
templates/minis/ow.html Normal file
View file

@ -0,0 +1,33 @@
<style>
@font-face {
font-family: Big Noodle Too;
src: url("https://d3hmvhl7ru3t12.cloudfront.net/fonts/big-noodle-too-oblique-0762bcfb7ce452ecfa21830ab40ee34f9bf2e6fbcecb649c8995bd59fdf93a74a8345855c3890ec3901ac7ca442040112f37f387c98a57ced5af61d92ee8e06c.woff") format("woff");
font-style: italic;
font-weight: 400;
}
</style>
<div class="game-panel">
<div class="game-grid ow">
<div class="player">
<a href="https://playoverwatch.com/en-us/career/pc/eu/{{ ow.__str__(separator='-') }}">
<img src="{{ ow.icon_url() }}" class="player-image">
<span class="player-name">{{ ow }}</span>
</a>
</div>
<div class="game-title level">
Livello
</div>
<div class="game-score level">
<span>{{ ow.level }}</span>
</div>
<div class="rank">
{% if ow.rank is none %}
<div class="icon"></div>
<span class="text">Non classificato</span>
{% else %}
<img class="icon" src="{{ ow.rank_url() }}">
<span class="text">{{ ow.rank }}</span>
{% endif %}
</div>
</div>
</div>

View file

@ -31,4 +31,7 @@
{% if lol %}
{% include "minis/lol.html" %}
{% endif %}
{% if ow %}
{% include "minis/ow.html" %}
{% endif %}
{% endblock %}

View file

@ -39,8 +39,9 @@ def page_profile(name: str):
rl = db_session.query(db.RocketLeague).join(db.Steam).filter_by(royal=user).one_or_none()
dota = db_session.query(db.Dota).join(db.Steam).filter_by(royal=user).one_or_none()
lol = db_session.query(db.LeagueOfLegends).filter_by(royal=user).one_or_none()
ow = db_session.query(db.Overwatch).filter_by(royal=user).one_or_none()
db_session.close()
return render_template("profile.html", royal=user, css=css, osu=osu, rl=rl, dota=dota, lol=lol, steam=steam)
return render_template("profile.html", royal=user, css=css, osu=osu, rl=rl, dota=dota, lol=lol, steam=steam, ow=ow)
@app.route("/login")