mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-03 00:12:16 +02:00
Fix the logic for in progress user within a portfolio
This commit is contained in:
parent
cd517ae885
commit
6bf34c8d3b
1 changed files with 9 additions and 7 deletions
|
@ -475,11 +475,13 @@ class User(AbstractUser):
|
|||
|
||||
def get_active_requests_count_in_portfolio(self, request):
|
||||
"""Return count of active requests for the portfolio associated with the request."""
|
||||
portfolio_id = request.session.get(
|
||||
"portfolio_id"
|
||||
) # Adjust based on how you store the portfolio ID in the session
|
||||
if not portfolio_id:
|
||||
return 0 # No portfolio ID found
|
||||
# Get the portfolio from the session using the existing method
|
||||
|
||||
portfolio = request.session.get("portfolio")
|
||||
print(f"Portfolio from session: {portfolio}")
|
||||
|
||||
if not portfolio:
|
||||
return 0 # No portfolio found
|
||||
|
||||
allowed_states = [
|
||||
DomainRequest.DomainRequestStatus.SUBMITTED,
|
||||
|
@ -487,9 +489,9 @@ class User(AbstractUser):
|
|||
DomainRequest.DomainRequestStatus.ACTION_NEEDED,
|
||||
]
|
||||
|
||||
# Assuming you have a way to filter domain requests by portfolio
|
||||
# Now filter based on the portfolio retrieved
|
||||
active_requests_count = self.domain_requests_created.filter(
|
||||
status__in=allowed_states, portfolio__id=portfolio_id # Ensure this field exists on the DomainRequest model
|
||||
status__in=allowed_states, portfolio=portfolio
|
||||
).count()
|
||||
|
||||
return active_requests_count
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue