[BUG] Replacement player position overwritten to None #412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This issue is related to #411, but wanted to create a separate PR, because I don't know if this is the correct way to solve it.
Problem was that I got the below exception.
This happened when calling the
MinutesPlayedAggregator
.The problem seemed to be that the below could not be constructed, because this replacement player had None for their position, and they only had 1 position.
This meant that the below was bypassed, but we still ended up with only 1 item.
Now, I think this happened because the same substitution event was processed 3 time, but I'm not 100% sure.
Because we set the
event.player.set_position(event.time, None)
after processing them to coming of the field, the second time we process this same substitution the replacement player get their position replaced by None as well.Like I said, I don't know if this is the preferred way to resolve, maybe we should avoid parsing the same substitution multiple times, but this TimeContainer code is incredibly confusing, so I was just glad to find something that works for me.