From 520b39cb0b840369bdbcb8ebb10eda2aba74e647 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 7 Aug 2024 11:52:16 +0300 Subject: [PATCH] groupbyfix --- cache/precache.py | 2 +- resolvers/reader.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cache/precache.py b/cache/precache.py index fc064af7..73aec39a 100644 --- a/cache/precache.py +++ b/cache/precache.py @@ -84,7 +84,7 @@ async def precache_data(): q = select(Topic).where(Topic.community == 1) topics = get_with_stat(q) for topic in topics: - topic_dict = topic.dict() if hasattr(topic, 'dict') else topic + topic_dict = topic.dict() if hasattr(topic, "dict") else topic await cache_topic(topic_dict) await asyncio.gather( precache_topics_followers(topic["id"], session), precache_topics_authors(topic_dict["id"], session) diff --git a/resolvers/reader.py b/resolvers/reader.py index fbbee939..367448b7 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -122,11 +122,11 @@ def query_shouts(): # Группируем по всем полям, которые не являются агрегатами q = q.group_by( - Shout.id, - reaction_stats_subquery.c.comments_stat, - reaction_stats_subquery.c.rating_stat, - authors_subquery.c.authors, - topics_subquery.c.topics + Shout.id, + reaction_stats_subquery.c.comments_stat, + reaction_stats_subquery.c.rating_stat, + authors_subquery.c.authors, + topics_subquery.c.topics, ) return q, aliased_reaction