mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-15 00:57:02 +02:00
changed strings to constants
This commit is contained in:
parent
438d6b097e
commit
14cfaa7f4c
1 changed files with 9 additions and 4 deletions
|
@ -9,6 +9,7 @@ from .domain_invitation import DomainInvitation
|
|||
from .transition_domain import TransitionDomain
|
||||
from .verified_by_staff import VerifiedByStaff
|
||||
from .domain import Domain
|
||||
from .domain_request import DomainRequest
|
||||
|
||||
from phonenumber_field.modelfields import PhoneNumberField # type: ignore
|
||||
|
||||
|
@ -69,23 +70,27 @@ class User(AbstractUser):
|
|||
|
||||
def get_approved_domains_count(self):
|
||||
"""Return count of approved domains"""
|
||||
allowed_states = ["unknown", "dns needed", "ready", "on hold"]
|
||||
allowed_states = [Domain.State.UNKNOWN, Domain.State.DNS_NEEDED, Domain.State.READY, Domain.State.ON_HOLD]
|
||||
approved_domains_count = self.domains.filter(state__in=allowed_states).count()
|
||||
return approved_domains_count
|
||||
|
||||
def get_active_requests_count(self):
|
||||
"""Return count of active requests"""
|
||||
allowed_states = ["submitted", "in review", "action needed"]
|
||||
allowed_states = [
|
||||
DomainRequest.DomainRequestStatus.SUBMITTED,
|
||||
DomainRequest.DomainRequestStatus.IN_REVIEW,
|
||||
DomainRequest.DomainRequestStatus.ACTION_NEEDED,
|
||||
]
|
||||
active_requests_count = self.domain_requests_created.filter(status__in=allowed_states).count()
|
||||
return active_requests_count
|
||||
|
||||
def get_rejected_requests_count(self):
|
||||
"""Return count of rejected requests"""
|
||||
return self.domain_requests_created.filter(status="rejected").count()
|
||||
return self.domain_requests_created.filter(status=DomainRequest.DomainRequestStatus.REJECTED).count()
|
||||
|
||||
def get_ineligible_requests_count(self):
|
||||
"""Return count of ineligible requests"""
|
||||
return self.domain_requests_created.filter(status="ineligible").count()
|
||||
return self.domain_requests_created.filter(status=DomainRequest.DomainRequestStatus.INELIGIBLE).count()
|
||||
|
||||
@classmethod
|
||||
def needs_identity_verification(cls, email, uuid):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue