This commit is contained in:
parent
ea28f5346c
commit
e58fbe263f
|
@ -328,7 +328,7 @@ async def load_shouts_unrated(_, info, limit: int = 50, offset: int = 0):
|
||||||
q.outerjoin(
|
q.outerjoin(
|
||||||
Reaction,
|
Reaction,
|
||||||
and_(
|
and_(
|
||||||
Reaction.shout_id == Shout.id,
|
Reaction.shout == Shout.id,
|
||||||
Reaction.reply_to.is_(None),
|
Reaction.reply_to.is_(None),
|
||||||
Reaction.kind.in_([ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]),
|
Reaction.kind.in_([ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]),
|
||||||
),
|
),
|
||||||
|
|
|
@ -101,13 +101,11 @@ async def get_cached_topic_by_slug(slug: str, get_with_stat):
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
topic_query = select(Topic).filter(Topic.slug == slug)
|
topic_query = select(Topic).filter(Topic.slug == slug)
|
||||||
result = get_with_stat(session.execute(topic_query))
|
result = get_with_stat(session.execute(topic_query))
|
||||||
if isinstance(result, list) and len(result) > 0:
|
if result:
|
||||||
[topic] = result
|
topic = result if isinstance(result, Topic) else result[0]
|
||||||
elif isinstance(result, Topic):
|
if topic:
|
||||||
topic = result
|
await cache_topic(topic)
|
||||||
if topic:
|
return topic
|
||||||
await cache_topic(topic)
|
|
||||||
return topic
|
|
||||||
|
|
||||||
|
|
||||||
async def get_cached_authors_by_ids(authors_ids: List[int]) -> List[Author | dict]:
|
async def get_cached_authors_by_ids(authors_ids: List[int]) -> List[Author | dict]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user