def get_created_games_by_user(user=None): """ :return: all games in the database that were created by the provided user """ if user is not None: return filter(lambda x: owning_game(element=x, user=user), Game.all()) return list()
def get_games_not_joined_by_user(user=None): """ :return: all games in the database that are actives and the user hasn't joined yet """ if user is not None: result = list() for game in Game.all(): if game not in get_active_games_by_user( user=user) and game not in get_created_games_by_user( user=user) and game not in get_completed_games_by_user( user=user): result.append(game) return result return list()