Skip to content

Commit

Permalink
chore: potential refactor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brwali committed Oct 27, 2024
1 parent dfd05a7 commit 414b124
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ 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)
username = user?(user) ? user.username : user.name
raise "The user #{username} is already a member of the team #{name}" if user?(user)

can_add_member = false
unless full?
Expand All @@ -88,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.name, "Added member to the team #{id}")
ExpertizaLogger.info LoggerMessage.new('Model:Team', username, "Added member to the team #{id}")
end
can_add_member
end
Expand Down

0 comments on commit 414b124

Please sign in to comment.