Skip to content

Commit

Permalink
Merge branch 'master' of github.com:PySport/kloppy
Browse files Browse the repository at this point in the history
  • Loading branch information
koenvossen committed Aug 11, 2021
2 parents 98399ea + c4ebd4e commit 68954d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kloppy/infra/serializers/event/statsbomb/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
SB_SHOT_OUTCOME_POST = 99
SB_SHOT_OUTCOME_SAVED = 100
SB_SHOT_OUTCOME_OFF_WAYWARD = 101
SB_SHOT_OUTCOME_SAVED_OFF_TARGET = 115
SB_SHOT_OUTCOME_SAVED_TO_POST = 116

SB_EVENT_TYPE_FREE_KICK = 62
SB_EVENT_TYPE_THROW_IN = 67
Expand Down Expand Up @@ -216,6 +218,10 @@ def _parse_shot(shot_dict: Dict) -> Dict:
result = ShotResult.OFF_TARGET
elif outcome_id == SB_SHOT_OUTCOME_SAVED:
result = ShotResult.SAVED
elif outcome_id == SB_SHOT_OUTCOME_SAVED_OFF_TARGET:
result = ShotResult.SAVED
elif outcome_id == SB_SHOT_OUTCOME_SAVED_TO_POST:
result = ShotResult.SAVED
elif outcome_id == SB_SHOT_OUTCOME_POST:
result = ShotResult.POST
elif outcome_id == SB_SHOT_OUTCOME_OFF_WAYWARD:
Expand Down Expand Up @@ -575,7 +581,7 @@ def deserialize(
event = CarryEvent.create(
qualifiers=None,
# TODO: Consider moving this to _parse_carry
end_timestamp=timestamp + raw_event["duration"],
end_timestamp=timestamp + raw_event.get("duration", 0),
**carry_event_kwargs,
**generic_event_kwargs,
)
Expand Down

0 comments on commit 68954d2

Please sign in to comment.