diff --git a/resolvers/stat.py b/resolvers/stat.py index d17c3511..75057c58 100644 --- a/resolvers/stat.py +++ b/resolvers/stat.py @@ -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) diff --git a/services/precache.py b/services/precache.py index 424ac24c..8222cb37 100644 --- a/services/precache.py +++ b/services/precache.py @@ -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")