commit
09dbc82919
10 changed files with 73 additions and 76 deletions
119
Gemfile.lock
119
Gemfile.lock
|
@ -20,25 +20,25 @@ GEM
|
|||
specs:
|
||||
aasm (5.0.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
actioncable (5.2.3)
|
||||
actionpack (= 5.2.3)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
actionview (= 5.2.4.1)
|
||||
activejob (= 5.2.4.1)
|
||||
actionmailer (5.2.3)
|
||||
actionpack (= 5.2.3)
|
||||
actionview (= 5.2.3)
|
||||
activejob (= 5.2.3)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.4.1)
|
||||
actionview (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
actionpack (5.2.3)
|
||||
actionview (= 5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
actionview (5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
@ -46,9 +46,9 @@ GEM
|
|||
active_link_to (1.0.5)
|
||||
actionpack
|
||||
addressable
|
||||
active_model_serializers (0.10.10)
|
||||
actionpack (>= 4.1, < 6.1)
|
||||
activemodel (>= 4.1, < 6.1)
|
||||
active_model_serializers (0.10.8)
|
||||
actionpack (>= 4.1, < 6)
|
||||
activemodel (>= 4.1, < 6)
|
||||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
active_storage_validations (0.8.7)
|
||||
|
@ -56,22 +56,22 @@ GEM
|
|||
activejob (5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activerecord (5.2.4.1)
|
||||
activemodel (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activemodel (5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
activerecord (5.2.3)
|
||||
activemodel (= 5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
activerecord (= 5.2.4.1)
|
||||
activestorage (5.2.3)
|
||||
actionpack (= 5.2.3)
|
||||
activerecord (= 5.2.3)
|
||||
marcel (~> 0.3.1)
|
||||
activestorage-openstack (1.3.0)
|
||||
activestorage-openstack (1.2.0)
|
||||
fog-openstack (~> 1.0)
|
||||
marcel
|
||||
mime-types
|
||||
rails (>= 5.2.2)
|
||||
activesupport (5.2.4.1)
|
||||
activesupport (5.2.3)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -205,7 +205,7 @@ GEM
|
|||
ethon (0.11.0)
|
||||
ffi (>= 1.3.0)
|
||||
eventmachine (1.2.7)
|
||||
excon (0.72.0)
|
||||
excon (0.71.0)
|
||||
execjs (2.7.0)
|
||||
factory_bot (4.11.1)
|
||||
activesupport (>= 3.0.0)
|
||||
|
@ -221,9 +221,9 @@ GEM
|
|||
flipper (~> 0.17.2)
|
||||
rack (>= 1.4, < 3)
|
||||
rack-protection (>= 1.5.3, < 2.1.0)
|
||||
fog-core (2.2.0)
|
||||
fog-core (2.1.2)
|
||||
builder
|
||||
excon (~> 0.71)
|
||||
excon (~> 0.58)
|
||||
formatador (~> 0.2)
|
||||
mime-types
|
||||
fog-json (1.2.0)
|
||||
|
@ -239,9 +239,8 @@ GEM
|
|||
geocoder (1.6.0)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
gon (6.3.2)
|
||||
actionpack (>= 3.0.20)
|
||||
i18n (>= 0.7)
|
||||
gon (6.2.1)
|
||||
actionpack (>= 3.0)
|
||||
multi_json
|
||||
request_store (>= 1.0)
|
||||
graphiql-rails (1.7.0)
|
||||
|
@ -323,25 +322,25 @@ GEM
|
|||
activesupport (>= 4.2)
|
||||
aes_key_wrap
|
||||
bindata
|
||||
jsonapi-renderer (0.2.2)
|
||||
jsonapi-renderer (0.2.0)
|
||||
jwt (2.1.0)
|
||||
kaminari (1.2.0)
|
||||
kaminari (1.1.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.2.0)
|
||||
kaminari-activerecord (= 1.2.0)
|
||||
kaminari-core (= 1.2.0)
|
||||
kaminari-actionview (1.2.0)
|
||||
kaminari-actionview (= 1.1.1)
|
||||
kaminari-activerecord (= 1.1.1)
|
||||
kaminari-core (= 1.1.1)
|
||||
kaminari-actionview (1.1.1)
|
||||
actionview
|
||||
kaminari-core (= 1.2.0)
|
||||
kaminari-activerecord (1.2.0)
|
||||
kaminari-core (= 1.1.1)
|
||||
kaminari-activerecord (1.1.1)
|
||||
activerecord
|
||||
kaminari-core (= 1.2.0)
|
||||
kaminari-core (1.2.0)
|
||||
kaminari-core (= 1.1.1)
|
||||
kaminari-core (1.1.1)
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
letter_opener (1.7.0)
|
||||
launchy (~> 2.2)
|
||||
letter_opener_web (1.4.0)
|
||||
letter_opener_web (1.3.4)
|
||||
actionmailer (>= 3.2)
|
||||
letter_opener (~> 1.0)
|
||||
railties (>= 3.2)
|
||||
|
@ -368,10 +367,10 @@ GEM
|
|||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (0.9.2)
|
||||
mime-types (3.3.1)
|
||||
mime-types (3.3)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2019.1009)
|
||||
mimemagic (0.3.4)
|
||||
mimemagic (0.3.3)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.0)
|
||||
|
@ -451,7 +450,7 @@ GEM
|
|||
pry-byebug (3.6.0)
|
||||
byebug (~> 10.0)
|
||||
pry (~> 0.10)
|
||||
public_suffix (4.0.3)
|
||||
public_suffix (4.0.1)
|
||||
puma (3.12.2)
|
||||
pundit (2.0.1)
|
||||
activesupport (>= 3.0.0)
|
||||
|
@ -472,18 +471,18 @@ GEM
|
|||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.4.1)
|
||||
actioncable (= 5.2.4.1)
|
||||
actionmailer (= 5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
actionview (= 5.2.4.1)
|
||||
activejob (= 5.2.4.1)
|
||||
activemodel (= 5.2.4.1)
|
||||
activerecord (= 5.2.4.1)
|
||||
activestorage (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
rails (5.2.3)
|
||||
actioncable (= 5.2.3)
|
||||
actionmailer (= 5.2.3)
|
||||
actionpack (= 5.2.3)
|
||||
actionview (= 5.2.3)
|
||||
activejob (= 5.2.3)
|
||||
activemodel (= 5.2.3)
|
||||
activerecord (= 5.2.3)
|
||||
activestorage (= 5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.4.1)
|
||||
railties (= 5.2.3)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.4)
|
||||
actionpack (>= 5.0.1.x)
|
||||
|
@ -497,9 +496,9 @@ GEM
|
|||
rails-i18n (5.1.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 5.0, < 6)
|
||||
railties (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
railties (5.2.3)
|
||||
actionpack (= 5.2.3)
|
||||
activesupport (= 5.2.3)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
|
@ -516,7 +515,7 @@ GEM
|
|||
railties (>= 3.2)
|
||||
tilt
|
||||
regexp_parser (1.6.0)
|
||||
request_store (1.5.0)
|
||||
request_store (1.4.1)
|
||||
rack (>= 1.4)
|
||||
responders (3.0.0)
|
||||
actionpack (>= 5.0)
|
||||
|
|
|
@ -232,7 +232,6 @@ module Instructeurs
|
|||
|
||||
def update_email_notifications
|
||||
assign_to.update!(assign_to_params)
|
||||
assign_to.update!(daily_email_notifications_enabled: params[:assign_to][:email_notifications_enabled])
|
||||
flash.notice = 'Vos notifications sont enregistrées.'
|
||||
redirect_to instructeur_procedure_path(procedure)
|
||||
end
|
||||
|
@ -247,7 +246,7 @@ module Instructeurs
|
|||
private
|
||||
|
||||
def assign_to_params
|
||||
params.require(:assign_to).permit(:email_notifications_enabled, :weekly_email_notifications_enabled)
|
||||
params.require(:assign_to).permit(:daily_email_notifications_enabled, :weekly_email_notifications_enabled)
|
||||
end
|
||||
|
||||
def assign_exports
|
||||
|
|
|
@ -3,13 +3,8 @@ class AssignTo < ApplicationRecord
|
|||
belongs_to :groupe_instructeur
|
||||
has_one :procedure_presentation, dependent: :destroy
|
||||
has_one :procedure, through: :groupe_instructeur
|
||||
before_save :save_to_new_daily_email_column
|
||||
|
||||
scope :with_email_notifications, -> { where(email_notifications_enabled: true) }
|
||||
|
||||
def save_to_new_daily_email_column
|
||||
self.daily_email_notifications_enabled = email_notifications_enabled
|
||||
end
|
||||
scope :with_email_notifications, -> { where(daily_email_notifications_enabled: true) }
|
||||
|
||||
def procedure_presentation_or_default_and_errors
|
||||
errors = reset_procedure_presentation_if_invalid
|
||||
|
|
|
@ -3,7 +3,7 @@ class NotificationService
|
|||
def send_instructeur_email_notification
|
||||
Instructeur
|
||||
.includes(assign_to: { procedure: :dossiers })
|
||||
.where(assign_tos: { email_notifications_enabled: true })
|
||||
.where(assign_tos: { daily_email_notifications_enabled: true })
|
||||
.find_in_batches { |instructeurs| send_batch_of_instructeurs_email_notification(instructeurs) }
|
||||
end
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
.radios
|
||||
%label
|
||||
= form.radio_button :email_notifications_enabled, true
|
||||
= form.radio_button :daily_email_notifications_enabled, true
|
||||
Oui
|
||||
|
||||
%label
|
||||
= form.radio_button :email_notifications_enabled, false
|
||||
= form.radio_button :daily_email_notifications_enabled, false
|
||||
Non
|
||||
|
||||
= form.label :email_notification, "Recevoir un récapitulatif hebdomadaire"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveEmailNotificationsEnabledFromAssignTos < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
remove_column :assign_tos, :email_notifications_enabled
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_02_18_144724) do
|
||||
ActiveRecord::Schema.define(version: 2020_02_27_100001) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -100,7 +100,6 @@ ActiveRecord::Schema.define(version: 2020_02_18_144724) do
|
|||
t.integer "procedure_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "email_notifications_enabled", default: false, null: false
|
||||
t.bigint "groupe_instructeur_id"
|
||||
t.boolean "weekly_email_notifications_enabled", default: true, null: false
|
||||
t.boolean "daily_email_notifications_enabled", default: false, null: false
|
||||
|
|
|
@ -424,7 +424,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
let(:assign_to) { instructeur.assign_to.joins(:groupe_instructeur).find_by(groupe_instructeurs: { procedure: procedure }) }
|
||||
|
||||
before do
|
||||
patch :update_email_notifications, params: { procedure_id: procedure.id, assign_to: { id: assign_to.id, email_notifications_enabled: true } }
|
||||
patch :update_email_notifications, params: { procedure_id: procedure.id, assign_to: { id: assign_to.id, daily_email_notifications_enabled: true } }
|
||||
end
|
||||
|
||||
it { expect(instructeur.groupe_instructeur_with_email_notifications).to eq([procedure.defaut_groupe_instructeur]) }
|
||||
|
|
|
@ -384,7 +384,7 @@ describe Instructeur, type: :model do
|
|||
let(:procedure_to_assign) { create(:procedure) }
|
||||
|
||||
before do
|
||||
create(:assign_to, instructeur: instructeur, procedure: procedure_to_assign, email_notifications_enabled: true, groupe_instructeur: procedure_to_assign.defaut_groupe_instructeur)
|
||||
create(:assign_to, instructeur: instructeur, procedure: procedure_to_assign, daily_email_notifications_enabled: true, groupe_instructeur: procedure_to_assign.defaut_groupe_instructeur)
|
||||
end
|
||||
|
||||
context 'when a dossier in construction exists' do
|
||||
|
|
|
@ -28,7 +28,7 @@ describe NotificationService do
|
|||
create(:assign_to,
|
||||
instructeur: instructeur_with_email_notifications,
|
||||
procedure: procedure,
|
||||
email_notifications_enabled: true)
|
||||
daily_email_notifications_enabled: true)
|
||||
end
|
||||
|
||||
context "when there is no activity on the instructeur's procedures" do
|
||||
|
|
Loading…
Reference in a new issue