-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
28 lines (22 loc) · 818 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from datetime import datetime
from flask import Flask, render_template
from get_champions import get_champions
app = Flask(__name__)
champions_and_skins = get_champions()
@app.route('/')
def index():
return render_template(
'index.html',
title='LoL Skin Count Data',
champions = champions_with_day_approximations(),
)
def champions_with_day_approximations():
full_list = champions_and_skins
today = datetime.today()
for champion in full_list:
champion_released_in = datetime.strptime(champion["champion_release_date"], "%d %B %Y")
difference_days = (today - champion_released_in).days
champion["champion_attention_division"] = difference_days // champion["champion_skin_count"]
return(full_list)
if __name__ == "__main__":
app.run()