fixed form completion bug with rating fields

This commit is contained in:
David Baldwynn 2017-07-27 01:22:58 -04:00
parent 66d41f5a80
commit 53b3196ad2
7 changed files with 30 additions and 27 deletions

View File

@ -1559,6 +1559,8 @@ angular.module('forms').run(['Menus',
var valid_count = fields.filter(function(field){
if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){
return !!(field.fieldValue);
} else if(field.fieldType === 'rating'){
return true;
}
}).length;
@ -3214,10 +3216,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
stats[deviceType].visits++;
if(!stats[deviceType].average_time) {
stats[deviceType].average_time = 0;
}
if (visitor.isSubmitted) {
stats[deviceType].total_time = stats[deviceType].total_time + visitor.timeElapsed;
stats[deviceType].responses++;
@ -3232,7 +3230,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
}
}
}
console.log(stats);
return stats;
})();

File diff suppressed because one or more lines are too long

View File

@ -482,8 +482,10 @@ angular.module('view-form')
var fields = formObj.form_fields;
var valid_count = fields.filter(function(field){
if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){
if(typeof field === 'object' && field.fieldType !== 'rating' && field.fieldType !== 'statement'){
return !!(field.fieldValue);
} else if (field.fieldType === 'rating'){
return true;
}
}).length;
@ -796,19 +798,19 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
$scope.forms = {};
TimeCounter.restartClock();
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement' || field.fieldType === 'rating'){
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement'){
return false;
}
return true;
}).length;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
$scope.reloadForm = function(){
//Reset Form

File diff suppressed because one or more lines are too long

View File

@ -17,8 +17,10 @@ angular.module('view-form')
var fields = formObj.form_fields;
var valid_count = fields.filter(function(field){
if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){
if(typeof field === 'object' && field.fieldType !== 'rating' && field.fieldType !== 'statement'){
return !!(field.fieldValue);
} else if (field.fieldType === 'rating'){
return true;
}
}).length;

View File

@ -22,19 +22,19 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
$scope.forms = {};
TimeCounter.restartClock();
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement' || field.fieldType === 'rating'){
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement'){
return false;
}
return true;
}).length;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
$scope.reloadForm = function(){
//Reset Form

View File

@ -28,6 +28,8 @@ angular.module('forms').run(['Menus',
var valid_count = fields.filter(function(field){
if(typeof field === 'object' && field.fieldType !== 'statement' && field.fieldType !== 'rating'){
return !!(field.fieldValue);
} else if(field.fieldType === 'rating'){
return true;
}
}).length;