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

Issue/#993 use single player validity state again #994

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
10 changes: 4 additions & 6 deletions server/games/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,14 @@ async def validate_game_mode_settings(self):
"""
A subset of checks that need to be overridden in coop games.
"""
if None in self.teams or not self.is_even:
await self.mark_invalid(ValidityState.UNEVEN_TEAMS_NOT_RANKED)
return

# TODO: This validity state seems to be impossible to get because it is
# already covered by UNEVEN_TEAMS_NOT_RANKED above.
if len(self.players) < 2:
await self.mark_invalid(ValidityState.SINGLE_PLAYER)
return

if None in self.teams or not self.is_even:
await self.mark_invalid(ValidityState.UNEVEN_TEAMS_NOT_RANKED)
return

valid_options = {
"Victory": (Victory.DEMORALIZATION, ValidityState.WRONG_VICTORY_CONDITION)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ async def test_single_player_not_rated(game, game_add_players):
game.launched_at = time.time() - 60 * 20
await game.add_result(0, 0, "victory", 5)
await game.on_game_finish()
assert game.validity is ValidityState.UNEVEN_TEAMS_NOT_RANKED
assert game.validity is ValidityState.SINGLE_PLAYER


async def test_game_visible_to_host(game: Game, players):
Expand Down