Skip to content

Commit

Permalink
Including the message in settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
phildominguez-gsa committed Dec 6, 2024
1 parent ba7a8ee commit adbf990
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 62 deletions.
2 changes: 2 additions & 0 deletions backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,13 @@
"start": None,
"end": datetime(2024, 10, 1),
"minimum": 750000,
"message": "$750,000 or more with a Fiscal Year starting BEFORE October 01, 2024",
},
{
"start": datetime(2024, 10, 1),
"end": None,
"minimum": 1000000,
"message": "$1,000,000 or more with a Fiscal Year starting ON or AFTER October 01, 2024",
},
]

Expand Down
39 changes: 1 addition & 38 deletions backend/report_submission/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.urls import reverse
from django.conf import settings
from unittest.mock import MagicMock, patch
from report_submission.views import DeleteFileView, EligibilityFormView
from report_submission.views import DeleteFileView
from model_bakery import baker

from audit.models import Access, SingleAuditChecklist, SubmissionEvent
Expand Down Expand Up @@ -164,43 +164,6 @@ def test_step_one_eligibility_submission_fail(self):
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, "/report_submission/eligibility/")

def test_step_one_generate_dollar_thresholds(self):
"""
/report_submissions/eligibility
Check that the correct threshold conditions are generated
"""
view = EligibilityFormView()

# Empty case
dollar_thresholds = []
result = []
self.assertEqual(view._generate_dollar_thresholds(dollar_thresholds), result)

# Normal case
dollar_thresholds = [
{
"start": None,
"end": date(2024, 1, 1),
"minimum": 750000,
},
{
"start": date(2024, 6, 1),
"end": date(2024, 12, 1),
"minimum": 900000,
},
{
"start": date(2024, 12, 1),
"end": None,
"minimum": 1000000,
},
]
result = [
"$750,000 or more with a Fiscal Year starting BEFORE January 01, 2024",
"$900,000 or more with a Fiscal Year starting ON or AFTER June 01, 2024 and BEFORE December 01, 2024",
"$1,000,000 or more with a Fiscal Year starting ON or AFTER December 01, 2024",
]
self.assertEqual(view._generate_dollar_thresholds(dollar_thresholds), result)

@patch("report_submission.forms.get_uei_info_from_sam_gov")
def test_end_to_end_submission_pass(self, mock_get_uei_info):
"""
Expand Down
27 changes: 3 additions & 24 deletions backend/report_submission/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,13 @@ class EligibilityFormView(LoginRequiredMixin, View):
def get(self, request):
args = {
"step": 1,
"dollar_thresholds": self._generate_dollar_thresholds(DOLLAR_THRESHOLDS),
"dollar_thresholds": [
dict_item["message"] for dict_item in DOLLAR_THRESHOLDS
],
}

return render(request, "report_submission/step-1.html", args)

# Used for populating the expenditure criteria bulletpoints
def _generate_dollar_thresholds(self, dollar_thresholds):
result = []
for dollar_threshold in dollar_thresholds:
start = dollar_threshold["start"]
end = dollar_threshold["end"]
minimum = format(dollar_threshold["minimum"], ",d")

if not start and end:
result.append(
f"${minimum} or more with a Fiscal Year starting BEFORE {end.strftime('%B %d, %Y')}"
)
elif start and end:
result.append(
f"${minimum} or more with a Fiscal Year starting ON or AFTER {start.strftime('%B %d, %Y')} and BEFORE {end.strftime('%B %d, %Y')}"
)
elif start and not end:
result.append(
f"${minimum} or more with a Fiscal Year starting ON or AFTER {start.strftime('%B %d, %Y')}"
)

return result

# gather/save step 1 info, redirect to step 2
def post(self, post_request):
eligibility = api.views.eligibility_check(post_request.user, post_request.POST)
Expand Down

0 comments on commit adbf990

Please sign in to comment.