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

FIX: min max player in room #377

Merged
merged 27 commits into from
Nov 27, 2022
Merged

Conversation

Segelzwerg
Copy link
Contributor

@Segelzwerg Segelzwerg commented Oct 25, 2022

Requires

Fixes #375

Breaking Change:

Matcher in table cannot be parsed in:

@classmethod
def create_with_pwd(cls, room_name: str, creator: Player, hashed_password: Optional[str] = None,
                    min_player: Optional[int] = None,
                    max_player: Optional[int] = None) -> 'RoomInDb':
    """
    Factory method to create a Room in database object.
    :param room_name: name of this session
    :param creator: player object of the host
    :param hashed_password: the hash value of the password required to join
    :param min_player: the minimum amount of player to start a room
    :param max_player: the maximum amount of player that can join this session
    :return: the Room object
    """
    min_player = 4 if min_player is None else int(min_player)
    max_player = 4 if max_player is None else int(max_player)
    room = RoomInDb.create(room_name, creator, min_player, max_player)
    return RoomInDb(**room.dict(exclude={'table': {'matcher'}}),
                    hashed_password=hashed_password)

See Whist-Team/Whist-Core#261 for details.

@Segelzwerg Segelzwerg self-assigned this Oct 25, 2022
@Segelzwerg Segelzwerg added the bug Something isn't working label Oct 25, 2022
Signed-off-by: Segelzwerg <[email protected]>
@codecov
Copy link

codecov bot commented Nov 8, 2022

Codecov Report

Merging #377 (247d5d9) into main (2c3e978) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #377   +/-   ##
=======================================
  Coverage   96.66%   96.66%           
=======================================
  Files          39       39           
  Lines         960      960           
=======================================
  Hits          928      928           
  Misses         32       32           
Impacted Files Coverage Δ
whist_server/api/room/action.py 100.00% <100.00%> (ø)
whist_server/api/room/create.py 100.00% <100.00%> (ø)
whist_server/database/room.py 98.91% <100.00%> (+0.03%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Segelzwerg
Copy link
Contributor Author

I have to revisit this one. May take a while.

@Segelzwerg Segelzwerg marked this pull request as draft November 8, 2022 16:19
# Conflicts:
#	poetry.lock
#	pyproject.toml
@Segelzwerg Segelzwerg marked this pull request as ready for review November 9, 2022 09:51
@Segelzwerg Segelzwerg marked this pull request as draft November 9, 2022 09:56
Signed-off-by: Segelzwerg <[email protected]>
pyproject.toml Outdated Show resolved Hide resolved
@Segelzwerg Segelzwerg marked this pull request as ready for review November 27, 2022 10:33
@iTitus iTitus merged commit 942f1bd into main Nov 27, 2022
@iTitus iTitus deleted the fix/room_player_settings_validation branch November 27, 2022 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Minimum player for a room can be bigger than maximum
2 participants