Skip to content
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

[StatsPerform] Ignore 19 - player on StatsPerform events as they are already incorporated in substitution event #361

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kloppy/infra/serializers/event/statsperform/deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,8 @@ def deserialize(self, inputs: StatsPerformInputs) -> EventDataset:
f"Set end of period {period.id} to {raw_event.timestamp}"
)
period.end_timestamp = raw_event.timestamp
elif raw_event.type_id == EVENT_TYPE_PLAYER_ON:
continue
else:
if not period.start_timestamp:
# not started yet
Expand Down
4 changes: 2 additions & 2 deletions kloppy/tests/issues/issue_60/test_issue_60.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_deleted_event_opta(self):
assert deleted_event_id not in df["event_id"].to_list()

# OPTA F24 file: Pass -> Deleted Event -> Tackle
assert event_dataset.events[16].event_name == "pass"
assert event_dataset.events[15].event_name == "pass"
assert (
event_dataset.events[17].event_name == "duel"
event_dataset.events[16].event_name == "duel"
) # Deleted Event is filter out
2 changes: 1 addition & 1 deletion kloppy/tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def read_to_stream(self, url: str, output: BinaryIO):
# Asserts borrowed from `test_opta.py`
assert dataset.metadata.provider == Provider.OPTA
assert dataset.dataset_type == DatasetType.EVENT
assert len(dataset.events) == 40
assert len(dataset.events) == 39
2 changes: 1 addition & 1 deletion kloppy/tests/test_statsperform.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_deserialize_all(self, event_dataset: EventDataset):
pitch_length=None,
pitch_width=None,
)
assert len(event_dataset.records) == 1652
assert len(event_dataset.records) == 1643

substitution_events = event_dataset.find_all("substitution")
assert len(substitution_events) == 9
Expand Down
Loading