Skip to content

Commit

Permalink
change any to all
Browse files Browse the repository at this point in the history
  • Loading branch information
michmuel committed Aug 30, 2024
1 parent 19e2f11 commit aed8369
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions pyramid_oereb/contrib/data_sources/standard/sources/plr.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ def handle_collection(self, session, geometry_real_estate, geometry_bbox):
self._tolerances['ALL']
)
)

elif (self._tolerances is not None) and (geometry_real_estate.geom_type in self._tolerances):
query = session.query(self._model_).options(
with_expression(
Expand All @@ -608,9 +609,10 @@ def handle_collection(self, session, geometry_real_estate, geometry_bbox):
ST_DWithin(
self._model_.geom,
from_shape(geometry_bbox, srid=Config.get('srid')),
self._tolerances[geometry_bbox.geom_type]
self._tolerances[geometry_real_estate.geom_type]
)
)

else:
query = session.query(
self._model_
Expand All @@ -626,6 +628,7 @@ def handle_collection(self, session, geometry_real_estate, geometry_bbox):
from_shape(geometry_bbox, srid=Config.get('srid'))
)
)

return query

def collect_related_geometries_by_real_estate_and_bbox(self, session, real_estate, bbox):
Expand Down Expand Up @@ -682,21 +685,8 @@ def read(self, params, real_estate, bbox): # pylint: disable=W:0221
geometry_results = self.collect_related_geometries_by_real_estate_and_bbox(
session, real_estate, bbox
)
# DEBUG
"""
log.debug("DEBUG MM 5 A")
for gr in geometry_results:
#log.debug(gr.__dict__.keys())
if hasattr(gr, 'inside_real_estate'):
log.debug(gr.inside_real_estate)
if hasattr(gr, 'law_status'):
log.debug(gr.law_status)
if hasattr(gr, 'public_law_restriction_id'):
log.debug(gr.public_law_restriction.law_status)
log.debug("DEBUG MM 5 B")
"""

if any([x.inside_real_estate for x in geometry_results]):

if all([not x.inside_real_estate for x in geometry_results]):
# We checked if there are spatially related elements in database. But there is none.
# So we can stop here.
self.records = [EmptyPlrRecord(
Expand Down

0 comments on commit aed8369

Please sign in to comment.