Browse Source

Merge pull request #88 from bcgov/DIV-1097

DIV-1097 Better handling of whitespace in responses
pull/163/head
Arianne 5 years ago
committed by GitHub
parent
commit
7d3cdc7856
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 11 deletions
  1. +1
    -1
      edivorce/apps/core/static/css/main.css
  2. +3
    -2
      edivorce/apps/core/static/css/main.scss
  3. +11
    -5
      edivorce/apps/core/static/js/main.js
  4. +3
    -2
      edivorce/apps/core/utils/conditional_logic.py
  5. +1
    -1
      edivorce/apps/core/utils/user_response.py

+ 1
- 1
edivorce/apps/core/static/css/main.css
File diff suppressed because it is too large
View File


+ 3
- 2
edivorce/apps/core/static/css/main.scss View File

@ -115,8 +115,9 @@ a {
&:hover {
color: darken( $brand-links, 10% );
text-decoration: underline;
-webkit-transition: all 0.1s eease-in-out;
transition: all 0.1s eease-in-out;
outline: none;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
}
}


+ 11
- 5
edivorce/apps/core/static/js/main.js View File

@ -450,7 +450,7 @@ $(function () {
$('#claimant_children').find('tbody:first').find('tr:gt(0)').each(function () {
var childData = {};
$(this).find('.child-field').each(function () {
childData[$(this).attr('data-target-form-field')] = $(this).text();
childData[$(this).attr('data-target-form-field')] = $(this).text().trim();
});
childrenData.push(childData);
});
@ -497,7 +497,7 @@ $(function () {
questionWell.find('.required').hide();
$(inputField).removeClass('error');
if (inputField.type === 'text') {
if (inputField.value === '') {
if (inputField.value.trim() === '') {
isNotEmpty = false;
$(inputField).addClass('error');
questionWell.addClass('error');
@ -960,10 +960,17 @@ var saveListControlRow = function(tableId) {
tableRows.each(function() {
var item = {};
var hasVal = false;
$(this).find(saveSelector).each(function() {
item[$(this).prop('name')] = $(this).val();
var val = $(this).val().trim();
item[$(this).prop('name')] = val;
if (val !== "" && val !== '0.00') {
hasVal = true;
}
});
payload.push(item);
if (hasVal) {
payload.push(item);
}
});
var jsonPayload = JSON.stringify(payload);
@ -971,7 +978,6 @@ var saveListControlRow = function(tableId) {
};
var replaceSuffix = function(str, suffix) {
if (str !== undefined && str.lastIndexOf('_') !== -1) {
str = str.substr(0, str.lastIndexOf('_'));


+ 3
- 2
edivorce/apps/core/utils/conditional_logic.py View File

@ -65,8 +65,9 @@ def determine_missing_undue_hardship_reasons(questions_dict):
except json.JSONDecodeError:
if value:
return False
return True
return True
else:
return False
def determine_child_support_payor(questions_dict):


+ 1
- 1
edivorce/apps/core/utils/user_response.py View File

@ -170,7 +170,7 @@ def save_to_db(serializer, question, value, bceid_user):
""" Saves form responses to the database """
data = {'bceid_user': bceid_user,
'question': question,
'value': value}
'value': value.strip()}
try:
instance = UserResponse.objects.get(bceid_user=bceid_user, question=question)
serializer.update(instance=instance, validated_data=data)


Loading…
Cancel
Save