debug-stat
All checks were successful
Deploy on push / deploy (push) Successful in 1m21s

This commit is contained in:
Untone 2024-02-25 09:48:16 +03:00
parent d58bbe3499
commit b2357e0afb
3 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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(

View File

@ -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 = {