From 257448e7f990718057e5d9065a27f4e79f9f084c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 7 Jun 2018 11:47:04 +0200 Subject: [PATCH] Cose che mi sono dimenticato sul portatile --- db.py | 17 +++++++++++++++ static/nryg.less | 47 +++++++++++++++++++++++++++++++++++++++++ templates/minis/ow.html | 33 +++++++++++++++++++++++++++++ templates/profile.html | 3 +++ webserver.py | 3 ++- 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 templates/minis/ow.html diff --git a/db.py b/db.py index 9642686a..581fd30b 100644 --- a/db.py +++ b/db.py @@ -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" diff --git a/static/nryg.less b/static/nryg.less index 1aeee5ba..9dbad4e1 100644 --- a/static/nryg.less +++ b/static/nryg.less @@ -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; } \ No newline at end of file diff --git a/templates/minis/ow.html b/templates/minis/ow.html new file mode 100644 index 00000000..6e9da9ee --- /dev/null +++ b/templates/minis/ow.html @@ -0,0 +1,33 @@ + +
+
+ +
+ Livello +
+
+ {{ ow.level }} +
+
+ {% if ow.rank is none %} +
+ Non classificato + {% else %} + + {{ ow.rank }} + {% endif %} +
+
+
\ No newline at end of file diff --git a/templates/profile.html b/templates/profile.html index 0160ac1c..928c6c04 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -31,4 +31,7 @@ {% if lol %} {% include "minis/lol.html" %} {% endif %} + {% if ow %} + {% include "minis/ow.html" %} + {% endif %} {% endblock %} \ No newline at end of file diff --git a/webserver.py b/webserver.py index cffc671b..83815f84 100644 --- a/webserver.py +++ b/webserver.py @@ -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")