game: core: replace is_in_game to get_game
This commit is contained in:
parent
c0efa07144
commit
13c49ed3c3
@ -16,12 +16,12 @@ class ProfileModel(models.Model):
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
avatar_url = models.ImageField(upload_to=upload_to, default="./profiles/static/avatars/default.avif") #blank=True, null=True)
|
||||
|
||||
def is_in_game(self):
|
||||
def get_game(self) -> int:
|
||||
for game in game_manager._game_list:
|
||||
for player in game.get_players_connected():
|
||||
if (player.user_id == self.user.pk):
|
||||
return True
|
||||
return False
|
||||
return game.game_id
|
||||
return None
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def on_user_created(sender, instance, created, **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user