From dfd05a714be36080261fb6ac5316f722553f8cf4 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sun, 27 Oct 2024 08:33:26 -0400 Subject: [PATCH] chore: fixed refactor errors --- app/controllers/invitations_controller.rb | 2 +- app/models/team.rb | 3 ++- danger | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) create mode 160000 danger diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index d508f77059b..504640e5f23 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -86,7 +86,7 @@ def create_utility def check_user_before_invitation # user is the student you are inviting to your team - @user = User.find_by(username: params[:user][:name].strip) + @user = User.find_by(username: params[:user][:username].strip) # User/Author has information about the participant @student = AssignmentParticipant.find(params[:student_id]) @assignment = Assignment.find(@student.parent_id) diff --git a/app/models/team.rb b/app/models/team.rb index 1b2259743b7..071e38f6b46 100755 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -78,6 +78,7 @@ def full? # Add member to the team, changed to hash by E1776 def add_member(user, _assignment_id = nil) + raise "The user #{user.username} is already a member of the team #{name}" if user?(user) can_add_member = false @@ -87,7 +88,7 @@ def add_member(user, _assignment_id = nil) parent = TeamNode.find_by(node_object_id: id) TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id) add_participant(parent_id, user) - ExpertizaLogger.info LoggerMessage.new('Model:Team', user.username, "Added member to the team #{id}") + ExpertizaLogger.info LoggerMessage.new('Model:Team', user.name, "Added member to the team #{id}") end can_add_member end diff --git a/danger b/danger new file mode 160000 index 00000000000..1ccfed23f80 --- /dev/null +++ b/danger @@ -0,0 +1 @@ +Subproject commit 1ccfed23f809a1e5c46e2533cfd7a3138f6cd821