Untitled
unknown
plain_text
a month ago
1.5 kB
0
Indexable
Never
def verify_area_id_children(session, area_id, customer_id): # Obtém todas as áreas do cliente all_areas = session.query(persist.tracking.VirtualArea).filter( persist.tracking.VirtualArea.customer_id == customer_id ).options( joinedload(persist.tracking.VirtualArea.virtual_area_points) ).all() # Obtém a área interna específica inner_area = session.query(persist.tracking.VirtualArea).filter( and_( persist.tracking.VirtualArea.id == area_id, persist.tracking.VirtualArea.customer_id == customer_id ) ).options( joinedload(persist.tracking.VirtualArea.virtual_area_points) ).all() if inner_area: for outer_area in all_areas: if gen.utils.areas_overlap(outer_area, inner_area): # Simula a definição do ID da área pai na resposta inner_area.parent_id = outer_area.id print(f"Simulação: Definindo parent_id da área {inner_area.id} como {outer_area.id}") return True return False if 'limit' in request: query = query.limit(int(request['limit'])) for e in query: if e.position_start: event.verify_area_id_children(session,e.position_start.virtual_area.id, customer.id) return {'data': query}
Leave a Comment