-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional play display compatibility #548
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! Here are some of my thoughts on this as it stands
@@ -45,6 +45,7 @@ def __init__(self, game_id, date, broadcasts, series_status, delay_in_10s_of_sec | |||
self._broadcasts = broadcasts | |||
self._series_status = series_status | |||
self._status = {} | |||
print(self.game_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print(self.game_id) |
"flies" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_fly" | ||
elif result == "field_out" and ( | ||
"grounds" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_ground" | ||
elif result == "field_out" and ( | ||
"lines" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_line" | ||
elif result == "field_out" and ( | ||
"pop" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_pop" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to turn this into a helper function called like out_type
elif result == "field_out" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
|
||
if result == "field_out_fly" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "field_out_ground" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "field_out_line" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "field_out_pop" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
|
||
if result == "sacrifice_fly" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "sacrifice_bunt" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
|
||
if result == "single" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "double" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "triple" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "walk" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" | ||
elif result == "hit_by_pitch" and ( | ||
"scores" | ||
in self._current_data["liveData"]["plays"].get("currentPlay", {}).get("result", {}).get("description", "") | ||
): | ||
result += "_rbi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, I think making a helper function called "did_score" or something could simplify this
Thanks for the detailed thoughts (some of which made me facepalm)! I'll revise accordingly. |
This pull request makes changes in data/plays.py and data/game.py to add compatibility with numerous other common plays in the scoreboard. This could be combined with changes in renderers/game/game.py to display many more play results on scoreboards (as I've done with the rest of the code on my personal repository).
Specifically:
All original plays and abbreviations should have been maintained and not break any existing functionality.
(I don't know what I'm doing, so please provide feedback if going about this incorrectly)