Skip to content

Commit

Permalink
fix: outerjoin and media_count based on existing relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
edelclaux committed Dec 9, 2024
1 parent 01fee68 commit a97ce97
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions backend/geonature/core/gn_synthese/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,13 +1053,10 @@ def taxon_observers(scope, cd_ref):
func.min(Synthese.date_min).label("date_min"),
func.max(Synthese.date_max).label("date_max"),
func.count(Synthese.id_synthese).label("observation_count"),
func.count(TMedias.uuid_attached_row).label("media_count"),
func.count(TMedias.id_media).label("media_count"),
)
.group_by("observer")
# .group_by(User.id_role)
# .join(CorObserverSynthese, CorObserverSynthese.id_synthese == Synthese.id_synthese)
# .join(User, User.id_role == CorObserverSynthese.id_role)
.outerjoin(TMedias, TMedias.uuid_attached_row == Synthese.unique_id_sinp)
.outerjoin(Synthese.medias)
.where(Synthese.cd_nom.in_(taxref_cd_nom_list))
)
query = TaxonSheetUtils.get_synthese_query_with_scope(g.current_user, scope, query)
Expand Down

0 comments on commit a97ce97

Please sign in to comment.