This commit is contained in:
parent
88d33f96b0
commit
c236768c07
|
@ -167,28 +167,19 @@ async def get_author(_, _info, slug="", author_id=None):
|
||||||
authors = get_authors_from_query(q)
|
authors = get_authors_from_query(q)
|
||||||
if authors:
|
if authors:
|
||||||
author = authors[0]
|
author = authors[0]
|
||||||
try:
|
with local_session() as session:
|
||||||
with local_session() as session:
|
comments_count = (
|
||||||
print(session)
|
session.query(Reaction)
|
||||||
comments_count = (
|
.filter(
|
||||||
session.query(Reaction)
|
and_(
|
||||||
.filter(
|
Reaction.created_by == author.id,
|
||||||
and_(
|
Reaction.kind == ReactionKind.COMMENT.value,
|
||||||
Reaction.created_by == author.id,
|
Reaction.deleted_at.is_(None),
|
||||||
Reaction.kind == ReactionKind.COMMENT.value,
|
|
||||||
Reaction.deleted_at.is_(None),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.count()
|
|
||||||
)
|
)
|
||||||
print(author.id)
|
.count()
|
||||||
print(comments_count)
|
)
|
||||||
author.stat["commented"] = comments_count
|
author.stat["commented"] = comments_count
|
||||||
except Exception as e:
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
traceback.print_exc()
|
|
||||||
print(e)
|
|
||||||
else:
|
else:
|
||||||
return {"error": "cant find author"}
|
return {"error": "cant find author"}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user