loadshouts-fix
All checks were successful
deploy / deploy (push) Successful in 2m10s

This commit is contained in:
Untone 2023-11-27 20:35:26 +03:00
parent 53a0f2e328
commit 3b0aedf959

View File

@ -96,8 +96,8 @@ async def load_shout(_, _info, slug=None, shout_id=None):
commented_stat,
rating_stat,
_last_comment,
] = session.execute(q).first()
] = session.execute(q).first() or []
if shout:
shout.stat = {
"viewed": viewed_stat,
"reacted": reacted_stat,
@ -149,13 +149,11 @@ async def load_shouts_by(_, info, options):
q = add_stat_columns(q)
user_id = info.context["user_id"]
filters = options.get("filters")
if filters:
with local_session() as session:
author = session.query(Author).filter(Author.user == user_id).first()
if author:
q = apply_filters(q, filters, author.id)
# TODO: some filtering logix?
pass
order_by = options.get("order_by", Shout.published_at)