logs-update-shout-5
All checks were successful
Deploy on push / deploy (push) Successful in 59s

This commit is contained in:
2025-02-02 21:57:51 +03:00
parent ffb75e53f7
commit 0347b6f5ff
3 changed files with 34 additions and 4 deletions

View File

@@ -63,12 +63,16 @@ def query_with_stat(info):
Добавляет подзапрос статистики
"""
q = (
select(Shout)
.where(and_(Shout.published_at.is_not(None), Shout.deleted_at.is_(None)))
.join(Author, Author.id == Shout.created_by)
q = select(Shout).filter(
and_(
Shout.published_at.is_not(None), # Проверяем published_at
Shout.deleted_at.is_(None), # Проверяем deleted_at
)
)
# Добавим логирование
logger.info(f"Base query filters: published_at IS NOT NULL AND deleted_at IS NULL")
# Главный автор
main_author = aliased(Author)
q = q.join(main_author, main_author.id == Shout.created_by)
@@ -143,6 +147,9 @@ def query_with_stat(info):
q = q.outerjoin(topics_subquery, topics_subquery.c.shout == Shout.id)
q = q.add_columns(topics_subquery.c.topics)
# Добавим логирование
logger.info("Added topics join to query")
if has_field(info, "stat"):
stats_subquery = (
select(