Skip to content

Commit

Permalink
Fetch data every time
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnandagopal committed Jan 19, 2024
1 parent d4faace commit 7ef13c3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(self, num: int, name: str):
self.rank_members()

def refresh_leaderboard_data(self):
print("fetched latest points")
self.data = fetch_data(self.num)

def rank_members(self):
Expand Down Expand Up @@ -109,11 +110,6 @@ def rank_members(self):
END_ACT: int = int(getenv("END_ACT"))
START_ACT: int = int(getenv("START_ACT"))

all_acts = [
Act(i, f"ACT {i} - {CURRENT_ACT_YEAR - END_ACT + i}")
for i in range(END_ACT, START_ACT, -1)
]


@app.route("/", methods=["GET"])
def index():
Expand All @@ -122,8 +118,10 @@ def index():

@app.route("/leaderboard", methods=["GET"])
def leaderboard():
for act in all_acts:
act.refresh_leaderboard_data()
all_acts = [
Act(i, f"ACT {i} - {CURRENT_ACT_YEAR - END_ACT + i}")
for i in range(END_ACT, START_ACT, -1)
]
return render_template("leaderboard.html", all_acts=all_acts, enumerate=enumerate)


Expand Down

0 comments on commit 7ef13c3

Please sign in to comment.