Skip to content

Commit

Permalink
Corrected desc that was doing oposite of what we wanted and added ord…
Browse files Browse the repository at this point in the history
…er_by by date instead of id_synthese
  • Loading branch information
Christophe-Ramet committed Jan 31, 2025
1 parent ba1b7b7 commit 96c7aca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/geonature/core/gn_synthese/utils/blurring.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def build_blurred_precise_geom_queries(
columns.append(sa.literal(0).label("size_hierarchy"))
precise_geom_query = SyntheseQuery(
Synthese,
sa.select(*columns).where(sa.and_(*where_clauses)).order_by(Synthese.id_synthese.desc()),
sa.select(*columns).where(sa.and_(*where_clauses)).order_by(Synthese.date_min.desc()),
filters=dict(filters), # not to edit the actual filter object
)

Expand Down Expand Up @@ -99,7 +99,7 @@ def build_blurred_precise_geom_queries(
== Synthese.id_nomenclature_sensitivity
)
.where(sa.and_(*where_clauses))
.order_by(Synthese.id_synthese.desc()),
.order_by(Synthese.date_min.desc()),
filters=dict(filters),
query_joins=sa.join(
Synthese,
Expand Down Expand Up @@ -181,8 +181,8 @@ def build_synthese_obs_query(observations, allowed_geom_cte, limit):
allowed_geom_cte, allowed_geom_cte.c.id_synthese == VSyntheseForWebApp.id_synthese
)
)
.order_by(VSyntheseForWebApp.id_synthese.desc(), allowed_geom_cte.c.priority)
.distinct(VSyntheseForWebApp.id_synthese)
.order_by(VSyntheseForWebApp.date_min.desc(), VSyntheseForWebApp.id_synthese, allowed_geom_cte.c.priority)
.distinct(VSyntheseForWebApp.date_min, VSyntheseForWebApp.id_synthese)
.limit(limit)
)
return obs_query

0 comments on commit 96c7aca

Please sign in to comment.