[CAPA] - When creating tasks designated user activity is missing - No notification is sent[SCI-9432]

This commit is contained in:
Giga Chubinidze 2023-10-25 12:11:05 +04:00
parent ba8782b339
commit 9dcb89e371

View file

@ -67,6 +67,7 @@ class MyModulesController < ApplicationController
subject: @my_module,
message_items: { my_module: @my_module.id }
)
log_user_assignment_activity
redirect_to canvas_experiment_path(@experiment) if params[:my_module][:view_mode] == 'canvas'
rescue ActiveRecord::RecordInvalid
render json: @my_module.errors, status: :unprocessable_entity
@ -545,6 +546,14 @@ class MyModulesController < ApplicationController
log_activity(type_of, @my_module, message_items)
end
def log_user_assignment_activity
users = User.where(id: params[:my_module][:user_ids])
users.each do |user|
log_activity(:designate_user_to_my_module, @my_module, { user_target: user.id })
end
end
def log_activity(type_of, my_module = nil, message_items = {})
my_module ||= @my_module
message_items = { my_module: my_module.id }.merge(message_items)