reaction.shout-fix
All checks were successful
Deploy on push / deploy (push) Successful in 1m7s

This commit is contained in:
Untone 2024-06-09 09:13:21 +03:00
parent ea28f5346c
commit e58fbe263f
2 changed files with 6 additions and 8 deletions

View File

@ -328,7 +328,7 @@ async def load_shouts_unrated(_, info, limit: int = 50, offset: int = 0):
q.outerjoin(
Reaction,
and_(
Reaction.shout_id == Shout.id,
Reaction.shout == Shout.id,
Reaction.reply_to.is_(None),
Reaction.kind.in_([ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]),
),

View File

@ -101,10 +101,8 @@ async def get_cached_topic_by_slug(slug: str, get_with_stat):
with local_session() as session:
topic_query = select(Topic).filter(Topic.slug == slug)
result = get_with_stat(session.execute(topic_query))
if isinstance(result, list) and len(result) > 0:
[topic] = result
elif isinstance(result, Topic):
topic = result
if result:
topic = result if isinstance(result, Topic) else result[0]
if topic:
await cache_topic(topic)
return topic