From e90d5aefb28093ee9e7ca7505902996362f7a08f Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 24 Apr 2024 10:30:32 +0300 Subject: [PATCH] stat-resolver-fix --- resolvers/stat.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/resolvers/stat.py b/resolvers/stat.py index 263d0eb8..3fa79b2d 100644 --- a/resolvers/stat.py +++ b/resolvers/stat.py @@ -178,20 +178,20 @@ def get_with_stat(q): with local_session() as session: result = session.execute(add_stat_handler(q)) - for cols in result: - entity = cols[0] - stat = dict() - stat["shouts"] = cols[1] - stat["followers"] = cols[2] - stat["authors"] = ( - get_author_authors_stat(entity.id) - if is_author - else get_topic_authors_stat(entity.id) - ) - if is_author: - stat["comments"] = get_author_comments_stat(entity.id) - entity.stat = stat - records.append(entity) + for cols in result: + entity = cols[0] + stat = dict() + stat["shouts"] = cols[1] + stat["followers"] = cols[2] + stat["authors"] = ( + get_author_authors_stat(entity.id) + if is_author + else get_topic_authors_stat(entity.id) + ) + if is_author: + stat["comments"] = get_author_comments_stat(entity.id) + entity.stat = stat + records.append(entity) except Exception as exc: logger.error(exc, exc_info=True) return records