Jon Solow
commited on
Commit
·
5325a29
1
Parent(s):
2e1e83c
Fix to elif to prevent double mapping defense stats
Browse files- src/stats.py +1 -2
src/stats.py
CHANGED
@@ -288,7 +288,7 @@ def add_yahoo_stat_type_to_stat_map(
|
|
288 |
player_id = ""
|
289 |
if yahoo_stat_type == "DEFENSE":
|
290 |
def_player_id = short_team_names_to_player_id[player["player"]["team"]["abbreviation"]]
|
291 |
-
|
292 |
raw_player_id = player["player"]["playerId"].split(".")[-1]
|
293 |
player_id = YAHOO_PLAYER_ID_MAP.get(raw_player_id, "")
|
294 |
def_player_id = short_team_names_to_player_id[player["player"]["team"]["abbreviation"]]
|
@@ -403,7 +403,6 @@ def get_yahoo_stats() -> dict[int, dict[str, dict[str, float]]]:
|
|
403 |
add_yahoo_stat_type_to_stat_map(stats_json["weeklyStatsFootballKicking"], "KICKING", stat_map)
|
404 |
add_yahoo_stat_type_to_stat_map(stats_json["weeklyStatsFootballReturns"], "RETURNING", stat_map)
|
405 |
add_yahoo_stat_type_to_stat_map(stats_json["weeklyStatsFootballDefense"], "DEFENSE", stat_map)
|
406 |
-
|
407 |
return stat_map
|
408 |
|
409 |
|
|
|
288 |
player_id = ""
|
289 |
if yahoo_stat_type == "DEFENSE":
|
290 |
def_player_id = short_team_names_to_player_id[player["player"]["team"]["abbreviation"]]
|
291 |
+
elif yahoo_stat_type == "RETURNING":
|
292 |
raw_player_id = player["player"]["playerId"].split(".")[-1]
|
293 |
player_id = YAHOO_PLAYER_ID_MAP.get(raw_player_id, "")
|
294 |
def_player_id = short_team_names_to_player_id[player["player"]["team"]["abbreviation"]]
|
|
|
403 |
add_yahoo_stat_type_to_stat_map(stats_json["weeklyStatsFootballKicking"], "KICKING", stat_map)
|
404 |
add_yahoo_stat_type_to_stat_map(stats_json["weeklyStatsFootballReturns"], "RETURNING", stat_map)
|
405 |
add_yahoo_stat_type_to_stat_map(stats_json["weeklyStatsFootballDefense"], "DEFENSE", stat_map)
|
|
|
406 |
return stat_map
|
407 |
|
408 |
|