Do not return deactivated portfolios in Portfolios.for_user

This commit is contained in:
dandds 2019-06-19 10:39:42 -04:00
parent a91d438d1c
commit 94d8680361
2 changed files with 7 additions and 0 deletions

View File

@ -48,6 +48,7 @@ class PortfoliosQuery(Query):
), ),
) )
) )
.filter(Portfolio.deleted == False)
.order_by(Portfolio.name.asc()) .order_by(Portfolio.name.asc())
.all() .all()
) )

View File

@ -219,3 +219,9 @@ def test_delete_failure_with_applications():
Portfolios.delete(portfolio=portfolio) Portfolios.delete(portfolio=portfolio)
assert not portfolio.deleted assert not portfolio.deleted
def test_for_user_does_not_include_deleted_portfolios():
user = UserFactory.create()
PortfolioFactory.create(owner=user, deleted=True)
assert len(Portfolios.for_user(user)) == 0