Skip to content

Commit

Permalink
task/WP-404: Add max lengths on certain registration form inputs + bu…
Browse files Browse the repository at this point in the history
…g/WP-406: Handle empty license and/or NAIC codes on DB write (#255)

* WP-404 add max length for some input fields

* WP-406 handle empty NAIC or license on db write
  • Loading branch information
edmondsgarrett authored Nov 30, 2023
1 parent b388e4b commit 803f007
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ <h5 id="entity_header_{{ent_no}}_{{r.reg_id}}">Entity {{ ent_no }}</h5>
class="textinput"
id="entity_name_{{ent_no}}_{{r.reg_id}}"
value="{{ entity.ent_name }}"
maxlength="255"
/>
</div>
<div class="field-wrapper required">
Expand Down Expand Up @@ -523,6 +524,7 @@ <h4>
required
class="textinput"
id="entity_name_1"
maxlength="255"
/>
</div>
<div class="field-wrapper required">
Expand Down Expand Up @@ -809,6 +811,7 @@ <h5 id="contact_header_{{ forloop.counter }}_{{r.reg_id}}">Contact {{ forloop.co
class="textinput"
id="contact_type_{{forloop.counter}}_{{r.reg_id}}"
value="{{ contact.role }}"
maxlength="100"
/>
</div>
<div class="field-wrapper textinput required">
Expand All @@ -823,6 +826,7 @@ <h5 id="contact_header_{{ forloop.counter }}_{{r.reg_id}}">Contact {{ forloop.co
class="textinput"
id="contact_name_{{forloop.counter}}_{{r.reg_id}}"
value="{{ contact.name }}"
maxlength="100"
/>
</div>
<div class="field-wrapper telephoneinput required">
Expand Down Expand Up @@ -879,6 +883,7 @@ <h5 id="contact_header_{{ forloop.counter }}_{{r.reg_id}}">Contact {{ forloop.co
id="contact_email_{{forloop.counter}}_{{r.reg_id}}"
pattern="^[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[a-z]{2,4}$"
value="{{ contact.email }}"
maxlength="50"
/>
</div>
<div class="field-wrapper checkboxinput">
Expand Down Expand Up @@ -927,6 +932,7 @@ <h4 id="contact_header_1">Contact Information</h4>
required
class="textinput"
id="contact_type"
maxlength="100"
/>
</div>
<div class="field-wrapper textinput required">
Expand All @@ -940,6 +946,7 @@ <h4 id="contact_header_1">Contact Information</h4>
required
class="textinput"
id="contact_name"
maxlength="100"
/>
</div>
<div class="field-wrapper telephoneinput required">
Expand Down Expand Up @@ -994,6 +1001,7 @@ <h4 id="contact_header_1">Contact Information</h4>
class="emailinput"
id="contact_email"
pattern="^[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[a-z]{2,4}$"
maxlength="50"
/>
</div>
<div class="field-wrapper checkboxinput">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
required
class="textinput"
id="entity_name_${entities}${reg_id_substr}"
maxlength="255"
/>
<div id="help-text-entity_name_${entities}" class="help-text">
</div>
Expand Down Expand Up @@ -440,6 +441,7 @@ <h6>
required
class="textinput"
id="contact_type_${contacts}${reg_id_substr}"
maxlength="100"
/>
</div>
<div class="field-wrapper textinput required">
Expand All @@ -451,6 +453,7 @@ <h6>
required
class="textinput"
id="contact_name_${contacts}${reg_id_substr}"
maxlength="100"
/>
</div>
<div class="field-wrapper telephoneinput required">
Expand Down Expand Up @@ -496,6 +499,7 @@ <h6>
class="emailinput"
pattern="^[A-Za-z0-9._%+\\-]+@[A-Za-z0-9.\\-]+\.[a-z]{2,4}$"
id="contact_email_${contacts}${reg_id_substr}"
maxlength="50"
/>
</div>
<div class="field-wrapper checkboxinput">
Expand Down
8 changes: 4 additions & 4 deletions apcd-cms/src/apps/utils/apcd_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ def create_registration_entity(form, reg_id, iteration, from_update_reg=None, ol
reg_id,
float(form['total_claims_value_{}'.format(str_end)]),
_set_int(form['claims_encounters_volume_{}'.format(str_end)]),
form['license_number_{}'.format(str_end)],
form['naic_company_code_{}'.format(str_end)],
form['license_number_{}'.format(str_end)] if len(form['license_number_{}'.format(str_end)]) else None,
form['naic_company_code_{}'.format(str_end)] if len(form['naic_company_code_{}'.format(str_end)]) else None,
_set_int(form['total_covered_lives_{}'.format(str_end)]),
_clean_value(form['entity_name_{}'.format(str_end)]),
_clean_value(form['fein_{}'.format(str_end)]),
Expand Down Expand Up @@ -424,8 +424,8 @@ def update_registration_entity(form, reg_id, iteration, no_entities):
values = (
float(form['total_claims_value_{}'.format(str_end)]),
_set_int(form['claims_encounters_volume_{}'.format(str_end)]),
form['license_number_{}'.format(str_end)],
form['naic_company_code_{}'.format(str_end)],
form['license_number_{}'.format(str_end)] if len(form['license_number_{}'.format(str_end)]) else None,
form['naic_company_code_{}'.format(str_end)] if len(form['naic_company_code_{}'.format(str_end)]) else None,
_set_int(form['total_covered_lives_{}'.format(str_end)]),
_clean_value(form['entity_name_{}'.format(str_end)]),
_clean_value(form['fein_{}'.format(str_end)]),
Expand Down

0 comments on commit 803f007

Please sign in to comment.