From 7ef13c30034a8eab4438937ddb1c3bfa984b2f11 Mon Sep 17 00:00:00 2001 From: Vishal N Date: Fri, 19 Jan 2024 23:00:25 +0530 Subject: [PATCH] Fetch data every time --- app.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 0f36fd9..0d09ac0 100644 --- a/app.py +++ b/app.py @@ -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): @@ -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(): @@ -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)