[Fix #2622] Change filters to proper JSONB
This commit is contained in:
parent
1419e9b73f
commit
7d382837d9
4 changed files with 5 additions and 8 deletions
|
@ -152,7 +152,7 @@ module NewGestionnaire
|
|||
'value' => params[:value]
|
||||
}
|
||||
|
||||
procedure_presentation.update(filters: filters.to_json)
|
||||
procedure_presentation.update(filters: filters)
|
||||
end
|
||||
|
||||
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
||||
|
@ -166,7 +166,7 @@ module NewGestionnaire
|
|||
|
||||
filters[statut] = filters[statut] - [filter_to_remove]
|
||||
|
||||
procedure_presentation.update(filters: filters.to_json)
|
||||
procedure_presentation.update(filters: filters)
|
||||
|
||||
redirect_back(fallback_location: gestionnaire_procedure_url(procedure))
|
||||
end
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
class ProcedurePresentation < ApplicationRecord
|
||||
belongs_to :assign_to
|
||||
|
||||
def filters
|
||||
JSON.parse(read_attribute(:filters))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,8 @@ namespace :'2018_09_20_procedure_presentation_jsonb' do
|
|||
ProcedurePresentation.update_all(
|
||||
<<~SQL
|
||||
displayed_fields = ('[' || ARRAY_TO_STRING(old_displayed_fields, ',') || ']')::JSONB,
|
||||
sort = (sort #>> '{}')::jsonb
|
||||
sort = (sort #>> '{}')::jsonb,
|
||||
filters = (filters #>> '{}')::jsonb
|
||||
SQL
|
||||
)
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ describe ProcedurePresentation do
|
|||
{ "label" => "test2", "table" => "champs" }
|
||||
],
|
||||
sort: { "table" => "user","column" => "email","order" => "asc" },
|
||||
filters: { "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "table1", "column" => "column1" }] }.to_json
|
||||
filters: { "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "table1", "column" => "column1" }] }
|
||||
).id
|
||||
}
|
||||
let (:procedure_presentation) { ProcedurePresentation.find(procedure_presentation_id) }
|
||||
|
|
Loading…
Reference in a new issue