fix: remove hidden_at_as_template from filter

This commit is contained in:
seb-by-ouidou 2023-09-21 13:50:23 +00:00
parent 0d2cd0fe5d
commit 5b9423bab3
2 changed files with 2 additions and 8 deletions

View file

@ -385,7 +385,6 @@ module Administrateurs
end
def all
params[:hidden_at_as_template] = nil
@filter = ProceduresFilter.new(current_administrateur, params)
all_procedures = filter_procedures(@filter).map { |p| ProcedureDetail.new(p) }
@ -402,7 +401,6 @@ module Administrateurs
end
def administrateurs
params[:hidden_at_as_template] = nil
@filter = ProceduresFilter.new(current_administrateur, params)
pids = AdministrateursProcedure.select(:administrateur_id).where(procedure: filter_procedures(@filter).map { |p| p["id"] })
@admins = Administrateur.includes(:user, :procedures).where(id: pids, procedures: { hidden_at_as_template: nil })
@ -420,7 +418,7 @@ module Administrateurs
procedures_result = Procedure.select(:id).left_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(hidden_at_as_template: nil) if filter.only_not_hidden_as_template?
procedures_result = procedures_result.where(hidden_at_as_template: nil)
procedures_result = procedures_result.where(aasm_state: filter.statuses) if filter.statuses.present?
procedures_result = procedures_result.where("tags @> ARRAY[?]::text[]", filter.tags) if filter.tags.present?
procedures_result = procedures_result.where('published_at >= ?', filter.from_publication_date) if filter.from_publication_date.present?

View file

@ -5,7 +5,7 @@ class ProceduresFilter
def initialize(admin, params)
@admin = admin
@params = params.permit(:page, :libelle, :email, :from_publication_date, :hidden_at_as_template, :service_siret, tags: [], zone_ids: [], statuses: [])
@params = params.permit(:page, :libelle, :email, :from_publication_date, :service_siret, tags: [], zone_ids: [], statuses: [])
end
def admin_zones
@ -36,10 +36,6 @@ class ProceduresFilter
params[:service_siret].presence
end
def only_not_hidden_as_template?
params.key?(:hidden_at_as_template) && params[:hidden_at_as_template].nil?
end
def from_publication_date
return if params[:from_publication_date].blank?