From 9dcb89e3719f9850f8c6710de57630db00469dc6 Mon Sep 17 00:00:00 2001 From: Giga Chubinidze Date: Wed, 25 Oct 2023 12:11:05 +0400 Subject: [PATCH] [CAPA] - When creating tasks designated user activity is missing - No notification is sent[SCI-9432] --- app/controllers/my_modules_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 07a6b549a..6f6e69a16 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -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)