From 5a7312f7758391c3aaa9cc0c55861cefdbde6c7a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 8 Apr 2021 16:43:45 +0100 Subject: [PATCH 1/3] Ensure address to_s never returns nil --- app/models/champs/address_champ.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/champs/address_champ.rb b/app/models/champs/address_champ.rb index d7cca4dc4..72da63012 100644 --- a/app/models/champs/address_champ.rb +++ b/app/models/champs/address_champ.rb @@ -39,7 +39,7 @@ class Champs::AddressChamp < Champs::TextChamp end def to_s - address_label + address_label.presence || '' end def for_tag From b24faae7e374d5279fa943bec16d44ae20c79cfc Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 7 Apr 2021 09:53:47 +0200 Subject: [PATCH 2/3] remove obsolete procedure_id column in assign_to table --- app/models/assign_to.rb | 1 - .../20210409075105_remove_procedure_id_from_assign_tos.rb | 5 +++++ db/schema.rb | 5 +---- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20210409075105_remove_procedure_id_from_assign_tos.rb diff --git a/app/models/assign_to.rb b/app/models/assign_to.rb index 449159fb5..30b42edf1 100644 --- a/app/models/assign_to.rb +++ b/app/models/assign_to.rb @@ -11,7 +11,6 @@ # updated_at :datetime # groupe_instructeur_id :bigint # instructeur_id :integer -# procedure_id :integer # class AssignTo < ApplicationRecord self.ignored_columns = [:procedure_id] diff --git a/db/migrate/20210409075105_remove_procedure_id_from_assign_tos.rb b/db/migrate/20210409075105_remove_procedure_id_from_assign_tos.rb new file mode 100644 index 000000000..5f71bcac1 --- /dev/null +++ b/db/migrate/20210409075105_remove_procedure_id_from_assign_tos.rb @@ -0,0 +1,5 @@ +class RemoveProcedureIdFromAssignTos < ActiveRecord::Migration[6.1] + def change + remove_column :assign_tos, :procedure_id, :number + end +end diff --git a/db/schema.rb b/db/schema.rb index 73e62912b..614ebec70 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_04_07_174523) do +ActiveRecord::Schema.define(version: 2021_04_09_075105) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -83,7 +83,6 @@ ActiveRecord::Schema.define(version: 2021_04_07_174523) do create_table "assign_tos", id: :serial, force: :cascade do |t| t.integer "instructeur_id" - t.integer "procedure_id" t.datetime "created_at" t.datetime "updated_at" t.bigint "groupe_instructeur_id" @@ -93,9 +92,7 @@ ActiveRecord::Schema.define(version: 2021_04_07_174523) do t.boolean "instant_email_dossier_notifications_enabled", default: false, null: false t.index ["groupe_instructeur_id", "instructeur_id"], name: "unique_couple_groupe_instructeur_instructeur", unique: true t.index ["groupe_instructeur_id"], name: "index_assign_tos_on_groupe_instructeur_id" - t.index ["instructeur_id", "procedure_id"], name: "index_assign_tos_on_instructeur_id_and_procedure_id", unique: true t.index ["instructeur_id"], name: "index_assign_tos_on_instructeur_id" - t.index ["procedure_id"], name: "index_assign_tos_on_procedure_id" end create_table "attestation_templates", id: :serial, force: :cascade do |t| From 6bb61ca64fe8f549f61d714d7843f96d414c6105 Mon Sep 17 00:00:00 2001 From: kara Diaby Date: Fri, 9 Apr 2021 12:56:09 +0200 Subject: [PATCH 3/3] add condition regarding experts emails in dossier controller instructeur --- app/controllers/instructeurs/dossiers_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/instructeurs/dossiers_controller.rb b/app/controllers/instructeurs/dossiers_controller.rb index 74930bfcb..2f414f292 100644 --- a/app/controllers/instructeurs/dossiers_controller.rb +++ b/app/controllers/instructeurs/dossiers_controller.rb @@ -60,7 +60,9 @@ module Instructeurs def avis @avis_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.avis_seen_at @avis = Avis.new - @experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort + if @dossier.procedure.feature_enabled?(:admin_affect_experts_to_avis) + @experts_emails = dossier.procedure.experts_procedures.where(revoked_at: nil).map(&:expert).map(&:email).sort + end end def personnes_impliquees