diff --git a/atst/domain/requests.py b/atst/domain/requests.py index fa122d71..a1102f92 100644 --- a/atst/domain/requests.py +++ b/atst/domain/requests.py @@ -137,6 +137,11 @@ class Requests(object): return dollar_value < cls.AUTO_APPROVE_THRESHOLD + _VALID_SUBMISSION_STATUSES = [ + RequestStatus.STARTED, + RequestStatus.CHANGES_REQUESTED, + ] + @classmethod def should_allow_submission(cls, request): all_request_sections = [ @@ -145,7 +150,7 @@ class Requests(object): "primary_poc", ] existing_request_sections = request.body.keys() - return request.status == RequestStatus.STARTED and all( + return request.status in Requests._VALID_SUBMISSION_STATUSES and all( section in existing_request_sections for section in all_request_sections ) diff --git a/atst/models/request.py b/atst/models/request.py index bd14b5db..44474ca3 100644 --- a/atst/models/request.py +++ b/atst/models/request.py @@ -27,3 +27,8 @@ class Request(Base): @property def status_displayname(self): return self.status_events[-1].displayname + + @property + def annual_spend(self): + monthly = self.body.get("details_of_use", {}).get("estimated_monthly_spend", 0) + return monthly * 12 diff --git a/atst/routes/requests/index.py b/atst/routes/requests/index.py index 69da2058..3f41b7b9 100644 --- a/atst/routes/requests/index.py +++ b/atst/routes/requests/index.py @@ -10,7 +10,7 @@ def map_request(request): time_created = pendulum.instance(request.time_created) is_new = time_created.add(days=1) > pendulum.now() app_count = request.body.get("details_of_use", {}).get("num_software_systems", 0) - annual_usage = request.body.get("details_of_use", {}).get("dollar_value", 0) + annual_usage = request.annual_spend update_url = url_for( "requests.requests_form_update", screen=1, request_id=request.id ) diff --git a/templates/requests/screen-4.html b/templates/requests/screen-4.html index 84c0e91e..6ae2fd4f 100644 --- a/templates/requests/screen-4.html +++ b/templates/requests/screen-4.html @@ -21,7 +21,7 @@
Before you can submit your request, please take a moment to review the information entered in the form. You may make changes by clicking the edit link on each section. When all information looks right, go ahead and submit.
- {% if f.errors or not can_submit%} + {% if f.errors or not can_submit %} {{ Alert('Please complete all sections', message="In order to submit your JEDI Cloud request, you'll need to complete all required sections of this form without error. Missing or invalid fields are noted below.
", level='error' @@ -114,20 +114,22 @@