diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index b2ebd110e..21d868e5b 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -27,16 +27,7 @@ def create @profile.email = current_user[:info][:email] if @profile.save - Agreement.create!(profile_id: @profile.id, form_item_id: 1, value: 1) if agreement_params['require_email'] - Agreement.create!(profile_id: @profile.id, form_item_id: 2, value: 1) if agreement_params['require_tel'] - Agreement.create!(profile_id: @profile.id, form_item_id: 3, value: 1) if agreement_params['require_posting'] - Agreement.create!(profile_id: @profile.id, form_item_id: 4, value: 1) if agreement_params['agree_ms'] - Agreement.create!(profile_id: @profile.id, form_item_id: 5, value: 1) if agreement_params['agree_ms_cndo2021'] - - Agreement.create!(profile_id: @profile.id, form_item_id: 6, value: 1) if agreement_params['ibm_require_email_cndt2022'] - Agreement.create!(profile_id: @profile.id, form_item_id: 7, value: 1) if agreement_params['ibm_require_tel_cndt2022'] - Agreement.create!(profile_id: @profile.id, form_item_id: 8, value: 1) if agreement_params['redhat_require_email_cndt2022'] - Agreement.create!(profile_id: @profile.id, form_item_id: 9, value: 1) if agreement_params['redhat_require_tel_cndt2022'] + create_agreement(@profile) ProfileMailer.registered(@profile, @conference).deliver_later if @profile.public_profile.present? @@ -175,4 +166,17 @@ def agreement_params :redhat_require_tel_cndt2022 ) end + + def create_agreement(profile) + Agreement.create!(profile_id: profile.id, form_item_id: 1, value: 1) if agreement_params['require_email'] + Agreement.create!(profile_id: profile.id, form_item_id: 2, value: 1) if agreement_params['require_tel'] + Agreement.create!(profile_id: profile.id, form_item_id: 3, value: 1) if agreement_params['require_posting'] + Agreement.create!(profile_id: profile.id, form_item_id: 4, value: 1) if agreement_params['agree_ms'] + Agreement.create!(profile_id: profile.id, form_item_id: 5, value: 1) if agreement_params['agree_ms_cndo2021'] + + Agreement.create!(profile_id: profile.id, form_item_id: 6, value: 1) if agreement_params['ibm_require_email_cndt2022'] + Agreement.create!(profile_id: profile.id, form_item_id: 7, value: 1) if agreement_params['ibm_require_tel_cndt2022'] + Agreement.create!(profile_id: profile.id, form_item_id: 8, value: 1) if agreement_params['redhat_require_email_cndt2022'] + Agreement.create!(profile_id: profile.id, form_item_id: 9, value: 1) if agreement_params['redhat_require_tel_cndt2022'] + end end