This commit is contained in:
parent
d58bbe3499
commit
b2357e0afb
|
@ -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
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user