Spaces:
Sleeping
Sleeping
Commit
·
6ab428e
1
Parent(s):
a8ab431
points redistribution
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ USERS_JSON = 'leaders/users.json'
|
|
| 16 |
MATCHES_JSON = 'matches.json'
|
| 17 |
OUTCOMES_JSON = 'match_outcomes.json'
|
| 18 |
OUTCOMES = 'outcomes/match_outcomes.json'
|
|
|
|
| 19 |
PLAYERS_JSON = 'players.json'
|
| 20 |
image_path = 'ipl_image.png'
|
| 21 |
|
|
@@ -223,6 +224,13 @@ def load_users(USERS_JSON):
|
|
| 223 |
except FileNotFoundError:
|
| 224 |
return {}
|
| 225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
def user_selection_and_prediction():
|
| 228 |
users = list(load_data(USERS_JSON))
|
|
@@ -293,7 +301,7 @@ def display_predictions():
|
|
| 293 |
|
| 294 |
def redistribute_lost_points(match_id) -> dict:
|
| 295 |
# Load already processed matches
|
| 296 |
-
done_matches =
|
| 297 |
|
| 298 |
if match_id in done_matches:
|
| 299 |
return {}
|
|
|
|
| 16 |
MATCHES_JSON = 'matches.json'
|
| 17 |
OUTCOMES_JSON = 'match_outcomes.json'
|
| 18 |
OUTCOMES = 'outcomes/match_outcomes.json'
|
| 19 |
+
BONUS_JSON = 'bonus/redistributed_matches.json'
|
| 20 |
PLAYERS_JSON = 'players.json'
|
| 21 |
image_path = 'ipl_image.png'
|
| 22 |
|
|
|
|
| 224 |
except FileNotFoundError:
|
| 225 |
return {}
|
| 226 |
|
| 227 |
+
def load_bonus(BONUS_JSON):
|
| 228 |
+
try:
|
| 229 |
+
with open(BONUS_JSON, 'r') as file:
|
| 230 |
+
return json.load(file)
|
| 231 |
+
except FileNotFoundError:
|
| 232 |
+
return []
|
| 233 |
+
|
| 234 |
|
| 235 |
def user_selection_and_prediction():
|
| 236 |
users = list(load_data(USERS_JSON))
|
|
|
|
| 301 |
|
| 302 |
def redistribute_lost_points(match_id) -> dict:
|
| 303 |
# Load already processed matches
|
| 304 |
+
done_matches = load_bonus(BONUS_JSON)
|
| 305 |
|
| 306 |
if match_id in done_matches:
|
| 307 |
return {}
|