Fix performance problem with looking up org members and add some tests
This commit is contained in:
parent
3080c47ef2
commit
9b31b9805a
2 changed files with 35 additions and 5 deletions
|
@ -750,9 +750,13 @@ def get_organization_team_member_invites(teamid):
|
|||
|
||||
def get_organization_member_set(orgname):
|
||||
Org = User.alias()
|
||||
user_teams = User.select(User.username).join(TeamMember).join(Team)
|
||||
with_org = user_teams.join(Org, on=(Org.username == orgname))
|
||||
return {user.username for user in with_org}
|
||||
org_users = (User.select(User.username)
|
||||
.join(TeamMember)
|
||||
.join(Team)
|
||||
.join(Org, on=(Org.id == Team.organization))
|
||||
.where(Org.username == orgname)
|
||||
.distinct())
|
||||
return {user.username for user in org_users}
|
||||
|
||||
|
||||
def get_teams_within_org(organization):
|
||||
|
|
Reference in a new issue