From 284bdc5b2b12dbc2485383726902117b047687e2 Mon Sep 17 00:00:00 2001 From: mfo Date: Tue, 24 Sep 2024 20:16:47 +0200 Subject: [PATCH] clean(deadcode): their is no column for avis.label. so clean this one --- app/models/procedure_presentation.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 8994db9de..c565c8604 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -240,22 +240,17 @@ class ProcedurePresentation < ApplicationRecord dossiers .includes(:followers_instructeurs) .joins('INNER JOIN users instructeurs_users ON instructeurs_users.id = instructeurs.user_id') - .filter_ilike('instructeurs_users', :email, values) - when 'user', 'individual', 'avis' + .filter_ilike('instructeurs_users', :email, values) # ilike OK, user may want to search by *@domain + when 'user', 'individual' # user_columns: [email], individual_columns: ['nom', 'prenom', 'gender'] dossiers .includes(table) - .filter_ilike(table, column, values) + .filter_ilike(table, column, values) # ilike or where column == 'value' are both valid, we opted for ilike when 'groupe_instructeur' assert_supported_column(table, column) - if column == 'label' - dossiers - .joins(:groupe_instructeur) - .filter_ilike(table, column, values) - else - dossiers - .joins(:groupe_instructeur) - .where(groupe_instructeur_id: values) - end + + dossiers + .joins(:groupe_instructeur) + .where(groupe_instructeur_id: values) end.pluck(:id) end end.reduce(:&)