create-reaction-fix3

This commit is contained in:
Untone 2024-11-02 19:48:43 +03:00
parent f4a8a653d0
commit bcb602d3cf

View File

@ -82,9 +82,10 @@ def get_reactions_with_stat(q, limit, offset):
with local_session() as session: with local_session() as session:
result_rows = session.execute(q) result_rows = session.execute(q)
for reaction, author, shout, commented_stat, rating_stat in result_rows: for reaction, author, shout, commented_stat, rating_stat in result_rows:
if shout is None: # Пропускаем реакции с отсутствующими shout или author
logger.error(f"пустое поле Shout: {reaction.dict()}") if not shout or not author:
continue # Или обработайте иначе logger.error(f"Пропущена реакция из-за отсутствия shout или author: {reaction.dict()}")
continue
reaction.created_by = author.dict() reaction.created_by = author.dict()
reaction.shout = shout.dict() reaction.shout = shout.dict()