debug(reader.py): trying to handle main topic ids founded
All checks were successful
Deploy on push / deploy (push) Successful in 54s
All checks were successful
Deploy on push / deploy (push) Successful in 54s
This commit is contained in:
parent
ae85b32f69
commit
ff3a4debce
|
@ -253,10 +253,10 @@ def get_shouts_with_links(info, q, limit=20, offset=0):
|
|||
"is_main": True,
|
||||
}
|
||||
elif not main_topic:
|
||||
logger.warning(f"No main_topic and no topics found for shout#{shout_id}")
|
||||
logger.debug(f"No main_topic and no topics found for shout#{shout_id}")
|
||||
main_topic = {"id": 0, "title": "no topic", "slug": "notopic", "is_main": True}
|
||||
shout_dict["main_topic"] = main_topic
|
||||
# logger.debug(f"Final main_topic for shout#{shout_id}: {main_topic}")
|
||||
logger.debug(f"Final main_topic for shout#{shout_id}: {main_topic}")
|
||||
|
||||
if has_field(info, "authors") and hasattr(row, "authors"):
|
||||
shout_dict["authors"] = (
|
||||
|
@ -420,6 +420,13 @@ async def load_shouts_search(_, info, text, options):
|
|||
)
|
||||
q = q.filter(Shout.id.in_(hits_ids))
|
||||
q = apply_filters(q, options)
|
||||
|
||||
# added this to join topics
|
||||
topic_join = aliased(ShoutTopic)
|
||||
topic = aliased(Topic)
|
||||
q = q.outerjoin(topic_join, topic_join.shout == Shout.id)
|
||||
q = q.outerjoin(topic, topic.id == topic_join.topic)
|
||||
|
||||
q = apply_sorting(q, options)
|
||||
shouts = get_shouts_with_links(info, q, limit, offset)
|
||||
for shout in shouts:
|
||||
|
|
Loading…
Reference in New Issue
Block a user