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

Game Rating: Clean up some formatting and faulty logic that I missed before #519

Merged
merged 2 commits into from
Jan 25, 2020

Conversation

Askaholic
Copy link
Collaborator

Now that I've spent some more time analysing game results, I realized that our game rating consistency checks were not quite right. Each army should have a consistent result reported (e.g. each player reports that army 1 was defeated) but each player on a team will not necessarily have the same game result. For instance if a player dies, but their teammates still carry them to victory, then the winning team will have at least one player with a defeat result and at least one player with a victory result. For this reason, victory results take precedence over all other results.

I also snuck in some other refactors like fixing functions that didn't exist or using is operator for numeric comparison instead of ==. All things that I missed when reading the code on github, but my linter caught easily.

@Askaholic Askaholic changed the title Clean up some formatting and faulty logic that I missed before Game Rating: Clean up some formatting and faulty logic that I missed before Jan 24, 2020
Copy link

@Wesmania Wesmania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@@ -410,7 +409,7 @@ def host_left_lobby() -> bool:
return
if self.state != GameState.LIVE:
return
if len([ conn for conn in self._connections.values() if not conn.finished_sim ]) > 0:
if len([conn for conn in self.connections if not conn.finished_sim]) > 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw: for such checks is good any(iterable)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. In this case it can even be if list:

@norraxx
Copy link
Collaborator

norraxx commented Jan 25, 2020

ok

@Askaholic Askaholic merged commit 4c92fae into FAForever:develop Jan 25, 2020
@Askaholic Askaholic deleted the game-rating-cleanup branch January 25, 2020 22:04
Brutus5000 pushed a commit that referenced this pull request Jan 27, 2020
…before (#519)

* Clean up some formatting and faulty logic that I missed before

* Simplify ended check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants