mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Merge pull request #2781 from alphagov/fix-slow-org-user-query
fix the sql
This commit is contained in:
@@ -127,8 +127,12 @@ def dao_get_invited_organisation_user(user_id):
|
|||||||
|
|
||||||
|
|
||||||
def dao_get_users_for_organisation(organisation_id):
|
def dao_get_users_for_organisation(organisation_id):
|
||||||
return User.query.filter(
|
return db.session.query(
|
||||||
User.organisations.any(id=organisation_id),
|
User
|
||||||
|
).join(
|
||||||
|
User.organisations
|
||||||
|
).filter(
|
||||||
|
Organisation.id == organisation_id,
|
||||||
User.state == 'active'
|
User.state == 'active'
|
||||||
).order_by(User.created_at).all()
|
).order_by(User.created_at).all()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user