diff --git a/resolvers/author.py b/resolvers/author.py index e6270bc3..b5bb2754 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -111,7 +111,7 @@ def load_authors_by(_, _info, by, limit, offset): q = q.limit(limit).offset(offset) - authors = get_authors_with_stat(q, ratings=True) + authors = get_authors_with_stat(q, ratings=False) return authors diff --git a/resolvers/rating.py b/resolvers/rating.py index 001c8782..3ad628c4 100644 --- a/resolvers/rating.py +++ b/resolvers/rating.py @@ -128,6 +128,7 @@ def load_author_ratings(author: Author): ) .count() ) + author.stat = author.stat if isinstance(author.stat, dict) else {} author.stat['rating'] = likes_count - dislikes_count author.stat['rating_shouts'] = count_author_shouts_rating(session, author.id) author.stat['rating_comments'] = count_author_comments_rating( diff --git a/resolvers/stat.py b/resolvers/stat.py index b82769a7..f0828485 100644 --- a/resolvers/stat.py +++ b/resolvers/stat.py @@ -70,6 +70,7 @@ def add_author_stat_columns(q): def execute_with_ministat(q): records = [] + logger.debug(f'execute with ministat: {q}') with local_session() as session: for [entity, shouts_stat, authors_stat, followers_stat] in session.execute(q): entity.stat = {