From 5b9423bab3fcdc9551fd4c00549b817c191465ef Mon Sep 17 00:00:00 2001 From: seb-by-ouidou Date: Thu, 21 Sep 2023 13:50:23 +0000 Subject: [PATCH] fix: remove hidden_at_as_template from filter --- app/controllers/administrateurs/procedures_controller.rb | 4 +--- app/models/procedures_filter.rb | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/controllers/administrateurs/procedures_controller.rb b/app/controllers/administrateurs/procedures_controller.rb index 9f97fbedd..f42e63808 100644 --- a/app/controllers/administrateurs/procedures_controller.rb +++ b/app/controllers/administrateurs/procedures_controller.rb @@ -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? diff --git a/app/models/procedures_filter.rb b/app/models/procedures_filter.rb index 280d572fb..54e8e0bb1 100644 --- a/app/models/procedures_filter.rb +++ b/app/models/procedures_filter.rb @@ -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?