Merge pull request #73 from ZmagoD/zd_SCI_344

fixes user duplication [fixes SCI-344]
This commit is contained in:
Zmago Devetak 2016-08-18 13:28:59 +02:00 committed by GitHub
commit 58930f3456

View file

@ -90,10 +90,11 @@ class Project < ActiveRecord::Base
def unassigned_users def unassigned_users
User User
.joins("INNER JOIN user_organizations ON users.id = user_organizations.user_id ") .joins('INNER JOIN user_organizations ON users.id = user_organizations.user_id')
.where("user_organizations.organization_id = ?", organization) .where('user_organizations.organization_id = ?', organization)
.where.not(confirmed_at: nil) .where.not(confirmed_at: nil)
.where("users.id NOT IN (?)", UserProject.where(project: self).select(:id).distinct) .where('users.id NOT IN (?)',
UserProject.where(project: self).select(:user_id).distinct)
end end
def user_role(user) def user_role(user)