From 15b1ddbda1af1b0de9909d104f316572314b5e50 Mon Sep 17 00:00:00 2001 From: sophia-massie <96220951+sophia-massie@users.noreply.github.com> Date: Mon, 6 Nov 2023 14:46:45 -0600 Subject: [PATCH] Task/WP 349 350 Business name change exten excep forms (#240) * task/wp-349-350-business-name-exten-excep - change only the form from org_name on submitter table to entity_name on submitter table * Removed spacing causing display issues * Spacing * spacing --- .../exception_other_form.html | 4 +- .../exception_threshold_form.html | 39 ++++++++++++------- apcd-cms/src/apps/exception/views.py | 13 +++---- .../extension_submission_form.html | 4 +- apcd-cms/src/apps/extension/views.py | 2 +- apcd-cms/src/apps/utils/apcd_database.py | 6 +-- 6 files changed, 41 insertions(+), 27 deletions(-) diff --git a/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_other_form.html b/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_other_form.html index f2c6e153..7684d06a 100644 --- a/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_other_form.html +++ b/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_other_form.html @@ -97,7 +97,9 @@

Acknowledgment of Terms

diff --git a/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html b/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html index a1258951..3d01b55a 100644 --- a/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html +++ b/apcd-cms/src/apps/exception/templates/exception_submission_form/exception_threshold_form.html @@ -33,6 +33,20 @@

Threshold Exception Request


Requested Threshold Reduction

+
+ + + + +
@@ -155,19 +169,6 @@

Acknowledgment of Terms

I request an exception on behalf of:
-
- - - - -
@@ -252,6 +253,18 @@

Acknowledgment of Terms

let exceptionBlock = document.getElementById(`exception_block_${exceptions}`); document.getElementById(`exception_header_${exceptions}`).style.display = 'block'; exceptionBlock.innerHTML = ` +
+ + + +
diff --git a/apcd-cms/src/apps/exception/views.py b/apcd-cms/src/apps/exception/views.py index 60dfd810..c7bdbd11 100644 --- a/apcd-cms/src/apps/exception/views.py +++ b/apcd-cms/src/apps/exception/views.py @@ -52,7 +52,7 @@ def _set_submitter(sub): "submitter_code": sub[1], "payor_code": sub[2], "user_name": sub[3], - "org_name": title_case(sub[4]) + "entity_name": title_case(sub[4]) } def _set_cdl(file_type): @@ -77,12 +77,8 @@ def post(self, request): errors = [] submitters = request.session.get('submitters') - submitter = next(submitter for submitter in submitters if int(submitter[0]) == int(form['business-name'])) - if _err_msg(submitter): - errors.append(_err_msg(submitter)) - + # To create counter of exception requests and corresponding fields max_iterations = 1 - for i in range(2, 6): if form.get('field-threshold-exception_{}'.format(i)): max_iterations += 1 @@ -90,6 +86,9 @@ def post(self, request): break for iteration in range(max_iterations): + submitter = next(submitter for submitter in submitters if int(submitter[0]) == int(form['business-name_{}'.format(iteration + 1)])) + if _err_msg(submitter): + errors.append(_err_msg(submitter)) except_response = apcd_database.create_threshold_exception(form, iteration + 1, submitter) if _err_msg(except_response): errors.append(_err_msg(except_response)) @@ -137,7 +136,7 @@ def _set_submitter(sub): "submitter_code": sub[1], "payor_code": sub[2], "user_name": sub[3], - "org_name": title_case(sub[4]) + "entity_name": title_case(sub[4]) } context["submitters"] = [] diff --git a/apcd-cms/src/apps/extension/templates/extension_submission_form/extension_submission_form.html b/apcd-cms/src/apps/extension/templates/extension_submission_form/extension_submission_form.html index 82d22467..e23b7d44 100644 --- a/apcd-cms/src/apps/extension/templates/extension_submission_form/extension_submission_form.html +++ b/apcd-cms/src/apps/extension/templates/extension_submission_form/extension_submission_form.html @@ -42,8 +42,8 @@

Extension Information

diff --git a/apcd-cms/src/apps/extension/views.py b/apcd-cms/src/apps/extension/views.py index db2ceef3..4d49227c 100644 --- a/apcd-cms/src/apps/extension/views.py +++ b/apcd-cms/src/apps/extension/views.py @@ -32,7 +32,7 @@ def _set_submitter(sub): "submitter_code": sub[1], "payor_code": sub[2], "user_name": sub[3], - "org_name": title_case(sub[4]) + "entity_name": title_case(sub[4]) } context["submitters"] = [] context["applicable_data_periods"] = [] diff --git a/apcd-cms/src/apps/utils/apcd_database.py b/apcd-cms/src/apps/utils/apcd_database.py index f1ae4852..0e215815 100644 --- a/apcd-cms/src/apps/utils/apcd_database.py +++ b/apcd-cms/src/apps/utils/apcd_database.py @@ -825,7 +825,7 @@ def create_threshold_exception(form, iteration, sub_data): ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) """ values = ( - _clean_value(form["business-name"]), + _clean_value(form['business-name_{}'.format(iteration)]), sub_data[1], sub_data[2], sub_data[3], @@ -1269,11 +1269,11 @@ def get_submitter_info(user): submitters.submitter_code, submitters.payor_code, submitter_users.user_id, - submitters.org_name + submitters.entity_name FROM submitter_users JOIN submitters ON submitter_users.submitter_id = submitters.submitter_id and submitter_users.user_id = (%s) - ORDER BY submitters.org_name, submitter_users.submitter_id + ORDER BY submitters.entity_name, submitter_users.submitter_id """ cur = conn.cursor() cur.execute(query, (user,))