diff --git a/app/database/models.py b/app/database/models.py index 1518fe3..fa1daea 100644 --- a/app/database/models.py +++ b/app/database/models.py @@ -14,6 +14,8 @@ class Player(db.Entity): hand = Set('Card') intention_creator = Optional('Intention', reverse='player') intention_objective = Optional('Intention', reverse='objective_player') + game_last_infected = Optional( + 'Game', reverse='last_infected', nullable=True) class Game(db.Entity): @@ -30,6 +32,8 @@ class Game(db.Entity): draw_deck_order = Required(Json, default=[]) round_direction = Required(str, default=RoundDirection.CLOCKWISE) intention = Optional('Intention', reverse='game') + last_infected = Optional( + Player, reverse='game_last_infected', nullable=True) class Card(db.Entity): diff --git a/app/routers/games/services.py b/app/routers/games/services.py index 8fdd920..4e41498 100644 --- a/app/routers/games/services.py +++ b/app/routers/games/services.py @@ -432,11 +432,13 @@ def get_game_result(name: str) -> GameResult: lambda p: p.rol != PlayerRol.THE_THING)[:] elif no_human_remains(game): - reason = "No queda ningún Humano en la partida." + reason = '''No queda ningún Humano en la partida. Todos fueron infectados o eliminados. + Pierden los eliminados y el último infectado.''' winners = game.players.select( lambda p: p.rol in [PlayerRol.THE_THING, PlayerRol.INFECTED])[:] losers = game.players.select( lambda p: p.rol == PlayerRol.ELIMINATED)[:] + losers.append(game.last_infected) # elif the_thing_declared_a_wrong_victory(game): else: