load_shouts_unrated-fix
All checks were successful
Deploy on push / deploy (push) Successful in 1m9s

This commit is contained in:
Untone 2024-06-06 11:13:54 +03:00
parent 626e899ca3
commit 543b2e6b4d
4 changed files with 7 additions and 9 deletions

View File

@ -10,10 +10,10 @@ from services.auth import login_required
from services.cache import (
cache_author,
get_cached_author,
get_cached_author_by_user_id,
get_cached_author_followers,
get_cached_follower_authors,
get_cached_follower_topics,
get_cached_author_by_user_id
)
from services.db import local_session
from services.logger import root_logger as logger

View File

@ -1,6 +1,5 @@
from sqlalchemy import bindparam, distinct, or_, text
from sqlalchemy.orm import aliased, joinedload
from sqlalchemy.sql.expression import and_, asc, case, desc, func, nulls_last, select
from sqlalchemy.sql.expression import and_, asc, bindparam, case, desc, distinct, func, nulls_last, or_, select, text
from orm.author import Author, AuthorFollower
from orm.reaction import Reaction, ReactionKind
@ -329,12 +328,12 @@ async def load_shouts_unrated(_, info, limit: int = 50, offset: int = 0):
q.outerjoin(
Reaction,
and_(
Reaction.shout == Shout.id,
Reaction.shout_id == Shout.id,
Reaction.reply_to.is_(None),
Reaction.kind.in_([ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]),
),
)
.outerjoin(Author, Author.user == bindparam("user_id"))
.outerjoin(Author, and_(Author.user == bindparam("user_id"), Reaction.created_by == Author.id))
.where(
and_(
Shout.deleted_at.is_(None),

View File

@ -21,12 +21,11 @@ async def request_data(gql, headers=None):
logger.error(f"HTTP Errors: {errors}")
else:
return data
except Exception as e:
except Exception as _e:
# Handling and logging exceptions during authentication check
import traceback
logger.error(f"request_data error: {e}")
logger.error(traceback.format_exc())
logger.error(f"request_data error: {traceback.format_exc()}")
return None