This commit is contained in:
parent
570c8a97e3
commit
9ca7a42d56
|
@ -180,7 +180,7 @@ def get_with_stat(q):
|
||||||
try:
|
try:
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
# detect author
|
# 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
|
# Add stat columns to the query
|
||||||
q = add_author_stat_columns(q) if is_author else add_topic_stat_columns(q)
|
q = add_author_stat_columns(q) if is_author else add_topic_stat_columns(q)
|
||||||
|
|
|
@ -19,7 +19,7 @@ async def precache_data():
|
||||||
topics_by_id = {}
|
topics_by_id = {}
|
||||||
|
|
||||||
# authors precache
|
# authors precache
|
||||||
authors = get_with_stat(select(Author))
|
authors = get_with_stat(select(Author).filter(Author.user.is_not(None)))
|
||||||
for a in authors:
|
for a in authors:
|
||||||
profile = a.dict() if not isinstance(a, dict) else a
|
profile = a.dict() if not isinstance(a, dict) else a
|
||||||
author_id = profile.get("id")
|
author_id = profile.get("id")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user