get-with-stat-debug
All checks were successful
Deploy on push / deploy (push) Successful in 30s

This commit is contained in:
Untone 2024-05-30 14:38:14 +03:00
parent 570c8a97e3
commit 9ca7a42d56
2 changed files with 2 additions and 2 deletions

View File

@ -180,7 +180,7 @@ def get_with_stat(q):
try:
with local_session() as session:
# detect author
is_author = f"{q}".lower().startswith("select author")
is_author = f"{q}".lower().startswith(["select author", "select * from author"])
# Add stat columns to the query
q = add_author_stat_columns(q) if is_author else add_topic_stat_columns(q)

View File

@ -19,7 +19,7 @@ async def precache_data():
topics_by_id = {}
# authors precache
authors = get_with_stat(select(Author))
authors = get_with_stat(select(Author).filter(Author.user.is_not(None)))
for a in authors:
profile = a.dict() if not isinstance(a, dict) else a
author_id = profile.get("id")