fix events accidently pulling inside chroma results loop

This commit is contained in:
Jason Hunter 2024-06-22 22:04:11 -04:00
parent 602a49ee3d
commit 9bc6ae4771

View File

@ -399,17 +399,16 @@ def events_search():
else "description", else "description",
} }
if not results:
return jsonify([])
# Get the event data # Get the event data
events = ( events = (
Event.select(*selected_columns) Event.select(*selected_columns)
.join( .join(
ReviewSegment, ReviewSegment,
JOIN.LEFT_OUTER, JOIN.LEFT_OUTER,
on=( on=(fn.json_extract(ReviewSegment.data, "$.detections").contains(Event.id)),
fn.json_extract(ReviewSegment.data, "$.detections").contains(
Event.id
)
),
) )
.where(Event.id << list(results.keys())) .where(Event.id << list(results.keys()))
.dicts() .dicts()