Update app.py
Browse files
app.py
CHANGED
@@ -166,9 +166,15 @@ def reward_status():
|
|
166 |
# Progress bar logic (percentage for current tier progress)
|
167 |
if current_tier != "Platinum":
|
168 |
next_tier_threshold = tiers[current_tier] if current_tier else 0
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
else:
|
171 |
-
progress_percentage = 100
|
172 |
|
173 |
return render_template(
|
174 |
'reward_status.html',
|
@@ -177,7 +183,6 @@ def reward_status():
|
|
177 |
points_needed_for_next_tier=points_needed_for_next_tier,
|
178 |
progress_percentage=progress_percentage
|
179 |
)
|
180 |
-
|
181 |
@app.route("/logout")
|
182 |
def logout():
|
183 |
# Retrieve table number before clearing session
|
|
|
166 |
# Progress bar logic (percentage for current tier progress)
|
167 |
if current_tier != "Platinum":
|
168 |
next_tier_threshold = tiers[current_tier] if current_tier else 0
|
169 |
+
max_points_for_tier = tiers.get(current_tier, 500)
|
170 |
+
|
171 |
+
# Prevent division by zero if the user is at the maximum points for the current tier
|
172 |
+
if max_points_for_tier > next_tier_threshold:
|
173 |
+
progress_percentage = (user_points - next_tier_threshold) / (max_points_for_tier - next_tier_threshold) * 100
|
174 |
+
else:
|
175 |
+
progress_percentage = 100 # If the user has already maxed out the tier
|
176 |
else:
|
177 |
+
progress_percentage = 100 # For Platinum, set the progress to 100%
|
178 |
|
179 |
return render_template(
|
180 |
'reward_status.html',
|
|
|
183 |
points_needed_for_next_tier=points_needed_for_next_tier,
|
184 |
progress_percentage=progress_percentage
|
185 |
)
|
|
|
186 |
@app.route("/logout")
|
187 |
def logout():
|
188 |
# Retrieve table number before clearing session
|