This commit is contained in:
parent
faa97d27c2
commit
49423ffb93
|
@ -9,11 +9,9 @@ async def get_unread_counter(chat_id: str, author_id: int) -> int:
|
||||||
|
|
||||||
|
|
||||||
async def get_total_unread_counter(author_id: int) -> int:
|
async def get_total_unread_counter(author_id: int) -> int:
|
||||||
chats = await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")
|
chats_set = await redis.execute("SMEMBERS", f"chats_by_author/{author_id}")
|
||||||
unread = 0
|
unread = 0
|
||||||
if chats:
|
for chat_id in list(chats_set):
|
||||||
chats = json.loads(chats)
|
n = await get_unread_counter(chat_id.decode("utf-8"), author_id)
|
||||||
for chat_id in chats:
|
unread += n
|
||||||
n = await get_unread_counter(chat_id.decode("utf-8"), author_id)
|
|
||||||
unread += n
|
|
||||||
return unread
|
return unread
|
||||||
|
|
Loading…
Reference in New Issue
Block a user