full commit of fixes to the survey by jared

This commit is contained in:
John Mitchell
2015-02-10 10:47:01 -05:00
parent 4a7b16ca05
commit d01ae1af6a
3 changed files with 357 additions and 275 deletions

View File

@@ -72,12 +72,18 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
}
}
if(scope.survey_enabled===true){
for (var fld in scope.job_launch_form){
//grab only survey question fields, including those that are zero or a blank answer (for optional questions)
if((scope[fld] || scope[fld] === 0 || scope[fld]==="") && scope.passwords_needed_to_start.indexOf(fld) === -1 && fld !== 'extra_vars'){
for (var i=0; i < scope.survey_questions.length; i++){
var fld = scope.survey_questions[i].variable;
// grab all survey questions that have answers
if(scope[fld]) {
job_launch_data.extra_vars[fld] = scope[fld];
}
// for optional text and text-areas, submit a blank string if min length is 0
if(scope.survey_questions[i].required === false && (scope.survey_questions[i].type === "text" || scope.survey_questions[i].type === "textarea") && scope.survey_questions[i].min === 0 && scope[fld] ===""){
job_launch_data.extra_vars[fld] = "";
}
}
}