fix: select distinct procedures

This commit is contained in:
Christophe Robillard 2022-11-25 19:37:23 +01:00
parent 3f34414145
commit d167a3ec71

View file

@ -346,7 +346,7 @@ module Administrateurs
private
def filter_procedures(filter)
procedures_result = Procedure.joins(:procedures_zones).publiees_ou_closes
procedures_result = Procedure.joins(:procedures_zones).distinct.publiees_ou_closes
procedures_result = procedures_result.where(procedures_zones: { zone_id: filter.zone_ids }) if filter.zone_ids.present?
procedures_result = procedures_result.where(aasm_state: filter.statuses) if filter.statuses.present?
procedures_result = procedures_result.where('published_at >= ?', filter.from_publication_date) if filter.from_publication_date.present?