From 975be32af107134c1ccf98c832ea508203954f69 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 13 Oct 2023 02:20:10 +0300 Subject: [PATCH] pp --- resolvers/load.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/resolvers/load.py b/resolvers/load.py index c33bee8..7a72912 100644 --- a/resolvers/load.py +++ b/resolvers/load.py @@ -45,14 +45,13 @@ async def load_messages(chat_id: str, limit: int = 5, offset: int = 0, ids=None) async def load_chats(_, info, limit: int = 50, offset: int = 0): """load :limit chats of current user with :offset""" author_id = info.context["author_id"] - cids = list( - (await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")) or [] - )[offset : offset + limit] + cids = (list(await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")) or [] + )[offset:(offset + limit)] members_online = (await redis.execute("SMEMBERS", "authors-online")) or [] chats = [] if len(cids) == 0: print(f"[resolvers.load] no chats for user with id={author_id}, create one with Discours (id=2)") - r = await create_chat(None, info, members=[2]) # member with id = 1 is discours + r = await create_chat(None, info, members=[2]) # member with id = 2 is discours cids.append(r["chat"]["id"]) for cid in cids: c = await redis.execute("GET", f"chats/{cid}")