Spaces:
Sleeping
Sleeping
jarajpu
commited on
Commit
·
ac41f6d
1
Parent(s):
659f15b
Removing 20% bid points cap
Browse files
app.py
CHANGED
|
@@ -164,9 +164,10 @@ def submit_prediction(
|
|
| 164 |
st.error("Prediction submission time has passed. Predictions can't be submitted after match start.")
|
| 165 |
return
|
| 166 |
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
|
|
|
| 170 |
|
| 171 |
prediction_id = uuid.uuid4().hex
|
| 172 |
prediction_time = datetime.now().strftime('%Y-%m-%d')
|
|
@@ -221,10 +222,10 @@ def get_user_total_points(user_name):
|
|
| 221 |
return users.get(user_name, {}).get("0", 0)
|
| 222 |
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
#
|
| 227 |
-
|
| 228 |
|
| 229 |
|
| 230 |
def load_users(USERS_JSON):
|
|
@@ -240,9 +241,9 @@ def user_selection_and_prediction():
|
|
| 240 |
user_name = st.selectbox("Select User", ["Select a user..."] + users)
|
| 241 |
|
| 242 |
max_bid_points = None
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
|
| 247 |
matches = get_today_matches()
|
| 248 |
if matches:
|
|
|
|
| 164 |
st.error("Prediction submission time has passed. Predictions can't be submitted after match start.")
|
| 165 |
return
|
| 166 |
|
| 167 |
+
if bid_points > max_bid_points:
|
| 168 |
+
# st.error(f"Your bid points exceed the 20% limit of your total points. Maximum allowed bid points: {max_bid_points}")
|
| 169 |
+
st.error(f"Oops! 🙈 Looks like you're going overboard with your bid points! Your bid points cannot exceed your total points. Maximum allowed bid points: {max_bid_points} 😱")
|
| 170 |
+
return
|
| 171 |
|
| 172 |
prediction_id = uuid.uuid4().hex
|
| 173 |
prediction_time = datetime.now().strftime('%Y-%m-%d')
|
|
|
|
| 222 |
return users.get(user_name, {}).get("0", 0)
|
| 223 |
|
| 224 |
|
| 225 |
+
def calculate_max_bid_points(user_name):
|
| 226 |
+
total_points = get_user_total_points(user_name)
|
| 227 |
+
# max_bid_points = int(total_points * 0.20) # 20% of total points
|
| 228 |
+
return total_points
|
| 229 |
|
| 230 |
|
| 231 |
def load_users(USERS_JSON):
|
|
|
|
| 241 |
user_name = st.selectbox("Select User", ["Select a user..."] + users)
|
| 242 |
|
| 243 |
max_bid_points = None
|
| 244 |
+
if user_name != "Select a user...":
|
| 245 |
+
max_bid_points = calculate_max_bid_points(user_name)
|
| 246 |
+
st.write(f"Maximum bid points you can submit: {max_bid_points}")
|
| 247 |
|
| 248 |
matches = get_today_matches()
|
| 249 |
if matches:
|