diff --git a/envergo/hedges/models.py b/envergo/hedges/models.py index 93567029d..a66f16864 100644 --- a/envergo/hedges/models.py +++ b/envergo/hedges/models.py @@ -137,10 +137,9 @@ def __str__(self): def __iter__(self): return iter(self.hedges()) - def get_bounding_box(self): - """Return the bounding box of the whole hedge set.""" + def get_bounding_box(self, hedges): + """Return the bounding box of the given hedge set.""" - hedges = self.hedges() min_x, min_y, max_x, max_y = hedges[0].geometry.bounds for hedge in hedges[1:]: x0, y0, x1, y1 = hedge.geometry.bounds @@ -237,7 +236,7 @@ def get_hedge_species(self): def get_local_species_codes(self): """Return species names that are known to live here.""" - bbox = self.get_bounding_box() + bbox = self.get_bounding_box(self.hedges_to_remove()) zones = Zone.objects.filter(geometry__intersects=bbox).filter( map__map_type="species" ) diff --git a/envergo/moulinette/templatetags/moulinette.py b/envergo/moulinette/templatetags/moulinette.py index 8a38a7b17..cab9b1567 100644 --- a/envergo/moulinette/templatetags/moulinette.py +++ b/envergo/moulinette/templatetags/moulinette.py @@ -305,8 +305,6 @@ def get_display_result(regulation): RESULTS.non_soumis, RESULTS.non_concerne, RESULTS.non_disponible, - RESULTS.derogation_inventaire, - RESULTS.derogation_simplifiee, ] return regulation.result if regulation.result not in other_results else "autre" @@ -320,13 +318,16 @@ def group_regulations_for_display(moulinette): result_cascade = [ RESULTS.interdit, RESULTS.soumis, + RESULTS.derogation_simplifiee, + RESULTS.derogation_inventaire, "autre", ] regulations_list.sort(key=lambda reg: result_cascade.index(get_display_result(reg))) # Group the regulations by their result - return { + grouped = { key: list(group) for key, group in groupby(regulations_list, key=get_display_result) } + return grouped diff --git a/envergo/static/sass/project.scss b/envergo/static/sass/project.scss index 5430cd483..c4e43e146 100644 --- a/envergo/static/sass/project.scss +++ b/envergo/static/sass/project.scss @@ -105,7 +105,7 @@ article { &.probability-soumis, &.probability-systematique, - &.probability-derogation, + &.probability-derogation_inventaire, &.probability-derogation_simplifiee, &.probability-4 { background-color: #ffb7a5; diff --git a/envergo/templates/haie/moulinette/result_base.html b/envergo/templates/haie/moulinette/result_base.html index 08fa6bf1c..7619c3729 100644 --- a/envergo/templates/haie/moulinette/result_base.html +++ b/envergo/templates/haie/moulinette/result_base.html @@ -41,7 +41,7 @@