commit
292a9fbb41
4 changed files with 11 additions and 5 deletions
|
@ -49,11 +49,11 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
explanatory_types_de_champ = [:header_section, :explication].map { |k| TypeDeChamp.type_champs.fetch(k) }
|
explanatory_types_de_champ = [:header_section, :explication].map { |k| TypeDeChamp.type_champs.fetch(k) }
|
||||||
|
|
||||||
fields.concat procedure.types_de_champ
|
fields.concat procedure.types_de_champ
|
||||||
.reject { |tdc| explanatory_types_de_champ.include?(tdc.type_champ) }
|
.where.not(type_champ: explanatory_types_de_champ)
|
||||||
.map { |type_de_champ| field_hash(type_de_champ.libelle, 'type_de_champ', type_de_champ.id.to_s) }
|
.map { |type_de_champ| field_hash(type_de_champ.libelle, 'type_de_champ', type_de_champ.id.to_s) }
|
||||||
|
|
||||||
fields.concat procedure.types_de_champ_private
|
fields.concat procedure.types_de_champ_private
|
||||||
.reject { |tdc| explanatory_types_de_champ.include?(tdc.type_champ) }
|
.where.not(type_champ: explanatory_types_de_champ)
|
||||||
.map { |type_de_champ| field_hash(type_de_champ.libelle, 'type_de_champ_private', type_de_champ.id.to_s) }
|
.map { |type_de_champ| field_hash(type_de_champ.libelle, 'type_de_champ_private', type_de_champ.id.to_s) }
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
|
@ -28,9 +28,9 @@ class ProcedureLogoUploader < BaseUploader
|
||||||
if file.present?
|
if file.present?
|
||||||
if original_filename.present? || model.logo_secure_token
|
if original_filename.present? || model.logo_secure_token
|
||||||
if Flipflop.remote_storage?
|
if Flipflop.remote_storage?
|
||||||
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
|
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension&.downcase}"
|
||||||
else
|
else
|
||||||
filename = "logo-#{secure_token}.#{file.extension.downcase}"
|
filename = "logo-#{secure_token}.#{file.extension&.downcase}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
filename
|
filename
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddProcedureIdIndexToTypesDeChamp < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_index :types_de_champ, :procedure_id
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2019_02_13_144145) do
|
ActiveRecord::Schema.define(version: 2019_02_26_105641) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -545,6 +545,7 @@ ActiveRecord::Schema.define(version: 2019_02_13_144145) do
|
||||||
t.bigint "parent_id"
|
t.bigint "parent_id"
|
||||||
t.index ["parent_id"], name: "index_types_de_champ_on_parent_id"
|
t.index ["parent_id"], name: "index_types_de_champ_on_parent_id"
|
||||||
t.index ["private"], name: "index_types_de_champ_on_private"
|
t.index ["private"], name: "index_types_de_champ_on_private"
|
||||||
|
t.index ["procedure_id"], name: "index_types_de_champ_on_procedure_id"
|
||||||
t.index ["stable_id"], name: "index_types_de_champ_on_stable_id"
|
t.index ["stable_id"], name: "index_types_de_champ_on_stable_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue