-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviews.py
More file actions
39 lines (31 loc) · 1.13 KB
/
Copy pathviews.py
File metadata and controls
39 lines (31 loc) · 1.13 KB
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
29
30
31
32
33
34
35
36
37
38
39
from flask import Blueprint, render_template
from leetcodescraper import url, GetData, GetDataFiltered, GetUser
from firebase import SetFirebaseData, GetFirebaseData
Data = None
views = Blueprint(__name__, "views")
@views.route("/")
def home():
global Data
if Data == None:
Data = GetData()
return render_template("index.html", data=Data)
@views.route("/problems")
def problems():
problemsList = GetFirebaseData()
return render_template("problems.html", data=problemsList)
@views.route("/problem/<problemname>")
def problem(problemname):
global Data
if Data == None:
Data = GetData()
filtredData = GetDataFiltered(Data, problemname)
return render_template("problem.html", data=filtredData)
@views.route("/user/<username>")
def user(username):
fullname,avatar,link,nbr_solved,recent_ac = GetUser(url+username)
return render_template("user.html", fullname=fullname, avatar=avatar, url=link, nbr_problem_solved=nbr_solved, recent_ac=recent_ac)
@views.route("/refresh", methods=["POST"])
def refresh():
global Data
Data = GetData()
return render_template("index.html", data=Data)