Spaces:
Sleeping
Sleeping
Commit
·
c630584
1
Parent(s):
df8e038
ipl 2025 players
Browse files- app.py +28 -9
- leaders/users.json +1 -1
- players.json +37 -45
- users.json +1 -1
app.py
CHANGED
|
@@ -207,8 +207,8 @@ def get_user_total_points(user_name):
|
|
| 207 |
|
| 208 |
def calculate_max_bid_points(user_name):
|
| 209 |
total_points = get_user_total_points(user_name)
|
| 210 |
-
|
| 211 |
-
return
|
| 212 |
|
| 213 |
|
| 214 |
def load_users(USERS_JSON):
|
|
@@ -350,21 +350,34 @@ user_guide_content = """
|
|
| 350 |
#### Submitting Predictions
|
| 351 |
- **Match Selection**: Choose the match you want to predict from today's available matches.
|
| 352 |
- **Team and Player Prediction**: Select the team you predict will win and the "Man of the Match".
|
| 353 |
-
- **Bid Points**: Enter the number of points you wish to bid on your prediction. Remember, the maximum you can bid is capped at 20% of your total points
|
| 354 |
|
| 355 |
#### Scoring System
|
| 356 |
-
- **Winning Team Prediction**:
|
| 357 |
-
- **
|
| 358 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
#### Bid Point Constraints
|
| 361 |
- You cannot bid more than 20% of your current total points.
|
| 362 |
- Bid points will be doubled if your prediction is correct, and deducted if incorrect.
|
| 363 |
|
| 364 |
#### Rules for Submission
|
| 365 |
-
- Predictions must be submitted before the match starts
|
| 366 |
-
- Only one prediction per match is allowed
|
| 367 |
-
- Review your prediction carefully before submission, as it cannot be changed once submitted
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
"""
|
| 369 |
|
| 370 |
# User Guide as an expander
|
|
@@ -456,12 +469,18 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match, ou
|
|
| 456 |
|
| 457 |
# Update user's points in the DataFrame
|
| 458 |
users_df[user_name][0]['points'] = user_points
|
|
|
|
| 459 |
|
| 460 |
# Maintain last 5 prediction results
|
| 461 |
if "last_5_results" not in users_df[user_name][0]:
|
| 462 |
users_df[user_name][0]["last_5_results"] = []
|
| 463 |
users_df[user_name][0]["last_5_results"].insert(0, result_indicator) # Insert at beginning
|
| 464 |
users_df[user_name][0]["last_5_results"] = users_df[user_name][0]["last_5_results"][:5] # Keep only last 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
|
| 466 |
users.to_json(USERS_JSON)
|
| 467 |
updated_dataset = Dataset.from_pandas(users_df)
|
|
|
|
| 207 |
|
| 208 |
def calculate_max_bid_points(user_name):
|
| 209 |
total_points = get_user_total_points(user_name)
|
| 210 |
+
max_bid_points = int(total_points * 0.20) # 20% of total points
|
| 211 |
+
return max_bid_points
|
| 212 |
|
| 213 |
|
| 214 |
def load_users(USERS_JSON):
|
|
|
|
| 350 |
#### Submitting Predictions
|
| 351 |
- **Match Selection**: Choose the match you want to predict from today's available matches.
|
| 352 |
- **Team and Player Prediction**: Select the team you predict will win and the "Man of the Match".
|
| 353 |
+
- **Bid Points**: Enter the number of points you wish to bid on your prediction. Remember, the maximum you can bid is capped at **20% of your total points**.
|
| 354 |
|
| 355 |
#### Scoring System
|
| 356 |
+
- **Winning Team Prediction**:
|
| 357 |
+
- ✅ **Correct Prediction**: You earn **2000 points** plus your bid amount.
|
| 358 |
+
- ❌ **Incorrect Prediction**: You lose **200 points** plus your bid amount.
|
| 359 |
+
- **Man of the Match Prediction**:
|
| 360 |
+
- ✅ **Correct Prediction**: You earn **an additional 500 points**.
|
| 361 |
+
- ❌ **Incorrect Prediction**: No penalty.
|
| 362 |
+
- **No Prediction Submitted**:
|
| 363 |
+
- ❌ **You lose 1000 points** automatically for not submitting a prediction.
|
| 364 |
|
| 365 |
#### Bid Point Constraints
|
| 366 |
- You cannot bid more than 20% of your current total points.
|
| 367 |
- Bid points will be doubled if your prediction is correct, and deducted if incorrect.
|
| 368 |
|
| 369 |
#### Rules for Submission
|
| 370 |
+
- **Predictions must be submitted before the match starts**.
|
| 371 |
+
- **Only one prediction per match is allowed**.
|
| 372 |
+
- **Review your prediction carefully before submission, as it cannot be changed once submitted**.
|
| 373 |
+
|
| 374 |
+
#### 🔴🟢⚪ Match Performance Tracking
|
| 375 |
+
- After each match, your last **5 predictions will be tracked** and displayed on the leaderboard:
|
| 376 |
+
- 🟢 **Green** → Correct prediction.
|
| 377 |
+
- 🔴 **Red** → Wrong prediction.
|
| 378 |
+
- ⚪ **White** → No prediction submitted.
|
| 379 |
+
|
| 380 |
+
🚀 **Compete, strategize, and climb the leaderboard!**
|
| 381 |
"""
|
| 382 |
|
| 383 |
# User Guide as an expander
|
|
|
|
| 469 |
|
| 470 |
# Update user's points in the DataFrame
|
| 471 |
users_df[user_name][0]['points'] = user_points
|
| 472 |
+
users[user_name][0]['points'] = user_points
|
| 473 |
|
| 474 |
# Maintain last 5 prediction results
|
| 475 |
if "last_5_results" not in users_df[user_name][0]:
|
| 476 |
users_df[user_name][0]["last_5_results"] = []
|
| 477 |
users_df[user_name][0]["last_5_results"].insert(0, result_indicator) # Insert at beginning
|
| 478 |
users_df[user_name][0]["last_5_results"] = users_df[user_name][0]["last_5_results"][:5] # Keep only last 5
|
| 479 |
+
|
| 480 |
+
if "last_5_results" not in users[user_name][0]:
|
| 481 |
+
users[user_name][0]["last_5_results"] = []
|
| 482 |
+
users[user_name][0]["last_5_results"].insert(0, result_indicator) # Insert at beginning
|
| 483 |
+
users[user_name][0]["last_5_results"] = users[user_name][0]["last_5_results"][:5] # Keep only last 5
|
| 484 |
|
| 485 |
users.to_json(USERS_JSON)
|
| 486 |
updated_dataset = Dataset.from_pandas(users_df)
|
leaders/users.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"Arpit": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Ganesh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Haaris": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Jay": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Kishore": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Megha": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Naveein": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Neha": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Praveen": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Rakesh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sai": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sahil": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sunil": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Vaibhav": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Vinay": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}}
|
|
|
|
| 1 |
+
{"Arpit": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Ganesh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Haaris": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Jay": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Kishore": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Megha": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Naveein": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Neha": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Praveen": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Rakesh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sai": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sahil": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sunil": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Vaibhav": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Vinay": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Anandh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Archana": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Biswabarenya": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Naitik": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Alekhya": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Siri Gowri": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Priyavrat Mohan": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}}
|
players.json
CHANGED
|
@@ -136,31 +136,27 @@
|
|
| 136 |
"Robin Minz"
|
| 137 |
],
|
| 138 |
"KKR": [
|
| 139 |
-
"Nitish Rana",
|
| 140 |
"Rinku Singh",
|
| 141 |
-
"
|
| 142 |
-
"
|
| 143 |
-
"Jason Roy",
|
| 144 |
-
"Anukul Roy",
|
| 145 |
"Andre Russell",
|
| 146 |
"Venkatesh Iyer",
|
| 147 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
"Harshit Rana",
|
| 149 |
-
"Sunil Narine",
|
| 150 |
-
"Vaibhav Arora",
|
| 151 |
-
"Varun Chakravarthy",
|
| 152 |
-
"KS Bharat",
|
| 153 |
-
"Chetan Sakariya",
|
| 154 |
-
"Mitchell Starc",
|
| 155 |
-
"Angkrish Raghuvanshi",
|
| 156 |
"Ramandeep Singh",
|
| 157 |
-
"
|
| 158 |
-
"
|
| 159 |
-
"
|
| 160 |
-
"
|
| 161 |
-
"
|
| 162 |
-
"Dushmantha Chameera",
|
| 163 |
-
"Phil Salt"
|
| 164 |
],
|
| 165 |
"LSG": [
|
| 166 |
"KL Rahul",
|
|
@@ -271,31 +267,27 @@
|
|
| 271 |
"Nandre Burger"
|
| 272 |
],
|
| 273 |
"RCB": [
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
"Lockie Ferguson",
|
| 296 |
-
"Tom Curran",
|
| 297 |
-
"Swapnil Singh",
|
| 298 |
-
"Saurav Chauhan"
|
| 299 |
],
|
| 300 |
"SRH": [
|
| 301 |
"Abdul Samad",
|
|
|
|
| 136 |
"Robin Minz"
|
| 137 |
],
|
| 138 |
"KKR": [
|
|
|
|
| 139 |
"Rinku Singh",
|
| 140 |
+
"Varun Chakaravarthy",
|
| 141 |
+
"Sunil Narine",
|
|
|
|
|
|
|
| 142 |
"Andre Russell",
|
| 143 |
"Venkatesh Iyer",
|
| 144 |
+
"Quinton de Kock",
|
| 145 |
+
"Anrich Nortje",
|
| 146 |
+
"Rahmanullah Gurbaz",
|
| 147 |
+
"Moeen Ali",
|
| 148 |
+
"Spencer Johnson",
|
| 149 |
+
"Rovman Powell",
|
| 150 |
+
"Ajinkya Rahane",
|
| 151 |
+
"Umran Malik",
|
| 152 |
+
"Manish Pandey",
|
| 153 |
"Harshit Rana",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
"Ramandeep Singh",
|
| 155 |
+
"Angkrish Raghuvanshi",
|
| 156 |
+
"Vaibhav Arora",
|
| 157 |
+
"Anukul Roy",
|
| 158 |
+
"Mayank Markande",
|
| 159 |
+
"Luvnith Sisodia"
|
|
|
|
|
|
|
| 160 |
],
|
| 161 |
"LSG": [
|
| 162 |
"KL Rahul",
|
|
|
|
| 267 |
"Nandre Burger"
|
| 268 |
],
|
| 269 |
"RCB": [
|
| 270 |
+
"Virat Kohli",
|
| 271 |
+
"Rajat Patidar",
|
| 272 |
+
"Yash Dayal",
|
| 273 |
+
"Liam Livingstone",
|
| 274 |
+
"Phil Salt",
|
| 275 |
+
"Jitesh Sharma",
|
| 276 |
+
"Josh Hazlewood",
|
| 277 |
+
"Bhuvneshwar Kumar",
|
| 278 |
+
"Krunal Pandya",
|
| 279 |
+
"Tim David",
|
| 280 |
+
"Suyash Sharma",
|
| 281 |
+
"Rasikh Dar",
|
| 282 |
+
"Jacob Bethell",
|
| 283 |
+
"Romario Shepherd",
|
| 284 |
+
"Nuwan Thushara",
|
| 285 |
+
"Devdutt Padikkal",
|
| 286 |
+
"Swapnil Singh",
|
| 287 |
+
"Swastik Chikara",
|
| 288 |
+
"Manoj Bhandage",
|
| 289 |
+
"Abhinandan Singh",
|
| 290 |
+
"Mohit Rathee"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
],
|
| 292 |
"SRH": [
|
| 293 |
"Abdul Samad",
|
users.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"Arpit": {"points": 10000, "wildcard": [0, 0, 0]}, "Ganesh": {"points": 10000, "wildcard": [0, 0, 0]}, "Haaris": {"points": 10000, "wildcard": [0, 0, 0]}, "Jay": {"points": 10000, "wildcard": [0, 0, 0]}, "Kishore": {"points": 10000, "wildcard": [0, 0, 0]}, "Megha": {"points": 10000, "wildcard": [0, 0, 0]}, "Naveein": {"points": 10000, "wildcard": [0, 0, 0]}, "Neha": {"points": 10000, "wildcard": [0, 0, 0]}, "Praveen": {"points": 10000, "wildcard": [0, 0, 0]}, "Rakesh": {"points": 10000, "wildcard": [0, 0, 0]}, "Sai": {"points": 10000, "wildcard": [0, 0, 0]}, "Sahil": {"points": 10000, "wildcard": [0, 0, 0]}, "Sunil": {"points": 10000, "wildcard": [0, 0, 0]}, "Vaibhav": {"points": 10000, "wildcard": [0, 0, 0]}, "Vinay": {"points": 10000, "wildcard": [0, 0, 0]}}
|
|
|
|
| 1 |
+
{"Arpit": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Ganesh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Haaris": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Jay": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Kishore": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Megha": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Naveein": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Neha": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Praveen": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Rakesh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sai": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sahil": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Sunil": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Vaibhav": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Vinay": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Anandh": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Archana": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Biswabarenya": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Naitik": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Alekhya": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Siri Gowri": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}, "Priyavrat Mohan": {"points": 10000, "wildcard": [0, 0, 0],"last_5_results": ["⚪", "⚪", "⚪", "⚪", "⚪"]}}
|