Skip to content

Commit

Permalink
Merge branch 'hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault committed Jan 29, 2025
2 parents 1b5ca14 + f93d89e commit 9f2e279
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions envergo/hedges/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
Expand Down
7 changes: 4 additions & 3 deletions envergo/moulinette/templatetags/moulinette.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
2 changes: 1 addition & 1 deletion envergo/static/sass/project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ article {

&.probability-soumis,
&.probability-systematique,
&.probability-derogation,
&.probability-derogation_inventaire,
&.probability-derogation_simplifiee,
&.probability-4 {
background-color: #ffb7a5;
Expand Down
2 changes: 1 addition & 1 deletion envergo/templates/haie/moulinette/result_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<h3>Réglementations interdisant le projet</h3>
{% elif result == "soumis" and moulinette.result != "soumis" %}
<h3>Autres réglementations concernant le projet</h3>
{% elif result == "soumis" %}
{% elif result != "autre" %}
<h3>Réglementations concernant le projet</h3>
{% else %}
<h3>Autres réglementations</h3>
Expand Down

0 comments on commit 9f2e279

Please sign in to comment.