clean(filter): avis column are not filterable, not needed to ilike them

This commit is contained in:
mfo 2024-09-24 20:21:24 +02:00
parent 284bdc5b2b
commit 51ce0cd562
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
2 changed files with 2 additions and 2 deletions

View file

@ -53,7 +53,7 @@ module ColumnsConcern
Column.new(table: 'user', column: 'email'), Column.new(table: 'user', column: 'email'),
Column.new(table: 'followers_instructeurs', column: 'email'), Column.new(table: 'followers_instructeurs', column: 'email'),
Column.new(table: 'groupe_instructeur', column: 'id', type: :enum), Column.new(table: 'groupe_instructeur', column: 'id', type: :enum),
Column.new(table: 'avis', column: 'question_answer', filterable: false) Column.new(table: 'avis', column: 'question_answer', filterable: false) # not filterable ?
] ]
end end

View file

@ -241,7 +241,7 @@ class ProcedurePresentation < ApplicationRecord
.includes(:followers_instructeurs) .includes(:followers_instructeurs)
.joins('INNER JOIN users instructeurs_users ON instructeurs_users.id = instructeurs.user_id') .joins('INNER JOIN users instructeurs_users ON instructeurs_users.id = instructeurs.user_id')
.filter_ilike('instructeurs_users', :email, values) # ilike OK, user may want to search by *@domain .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'] when 'user', 'individual'
dossiers dossiers
.includes(table) .includes(table)
.filter_ilike(table, column, values) # ilike or where column == 'value' are both valid, we opted for ilike .filter_ilike(table, column, values) # ilike or where column == 'value' are both valid, we opted for ilike