2ed100fad8b690a0170bb8cf578e1bfbbc223df9
[motion.git] / server / api / jscripty_project / jscripty_project.controller.js
1 var _0x3959=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x78\x6D\x6C\x32\x6A\x73","\x6C\x6F\x64\x61\x73\x68","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x4A\x73\x63\x72\x69\x70\x74\x79\x50\x72\x6F\x6A\x65\x63\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x53\x65\x73\x73\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x51\x75\x65\x73\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x49\x6E\x70\x75\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E\x73","\x73\x65\x73\x73\x69\x6F\x6E\x73","\x73\x63\x6F\x70\x65","\x73\x68\x6F\x77\x53\x65\x73\x73\x69\x6F\x6E","\x73\x65\x73\x73\x69\x6F\x6E\x49\x64","\x66\x69\x6E\x64","\x73\x68\x6F\x77\x49\x6E\x70\x75\x74\x73","\x72\x6F\x77\x73","\x73\x65\x73\x73\x69\x6F\x6E\x5F\x69\x64","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x79\x70\x65","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6C\x61\x62\x65\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x65\x78\x74","\x69\x6E\x70\x75\x74\x5F\x6C\x61\x62\x65\x6C","\x69\x6E\x70\x75\x74\x5F\x76\x61\x6C\x75\x65","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x63\x6F\x75\x6E\x74","\x6C\x65\x6E\x67\x74\x68","\x69\x6E\x70\x75\x74\x73","\x73\x68\x6F\x77\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77\x53\x75\x6D\x6D\x61\x72\x79","\x73\x75\x6D\x6D\x61\x72\x79","\x73\x68\x6F\x77\x51\x75\x65\x73\x74\x69\x6F\x6E\x44\x65\x74\x61\x69\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x69\x6E\x70\x75\x74","\x67\x72\x6F\x75\x70\x42\x79","\x6D\x61\x70","\x75\x6E\x69\x6F\x6E","\x6C\x61\x73\x74","\x6B\x65\x79\x73","\x6C\x61\x62\x65\x6C\x73","\x63\x68\x6F\x69\x63\x65\x73","\x67\x72\x61\x70\x68\x44\x61\x74\x61","\x67\x72\x61\x70\x68\x4C\x61\x62\x65\x6C\x73","\x62\x61\x72","\x52\x65\x70\x6F\x72\x74\x4A\x73\x63\x72\x69\x70\x74\x79\x49\x6E\x70\x75\x74\x73","\x76\x61\x6C\x75\x65","\x70\x65\x72\x63\x65\x6E\x74\x61\x67\x65","\x71\x75\x65\x73\x74\x69\x6F\x6E\x49\x64","\x63\x6F\x6C","\x66\x6E","\x63\x68\x65\x63\x6B\x62\x6F\x78","\x31","\x69\x6E\x70\x75\x74\x5F\x74\x79\x70\x65","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x70\x69\x65","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x61\x6E\x73\x77\x65\x72","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6F\x74\x68\x65\x72\x5F\x61\x6E\x73\x77\x65\x72","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6F\x74\x68\x65\x72\x5F\x6C\x61\x62\x65\x6C","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6F\x70\x74\x69\x6F\x6E\x73","\x70\x61\x72\x73\x65","\x6F\x70\x74\x69\x6F\x6E\x73","\x6F\x74\x68\x65\x72\x5F\x6F\x70\x74\x69\x6F\x6E","\x71\x75\x65\x73\x74\x69\x6F\x6E\x20\x74\x79\x70\x65\x20\x6E\x6F\x74\x20\x72\x65\x63\x6F\x67\x6E\x69\x7A\x65\x64","\x77\x61\x72\x6E","\x73\x68\x6F\x77\x44\x65\x74\x61\x69\x6C","\x63\x72\x65\x61\x74\x65","\x6E\x61\x6D\x65","\x66\x69\x65\x6C\x64\x73","\x6D\x65\x73\x73\x61\x67\x65","\x50\x72\x6F\x6A\x65\x63\x74\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x50\x52\x4F\x4A\x45\x43\x54","\x62\x6F\x64\x79","\x63\x72\x65\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x63\x72\x65\x61\x74\x65\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x61\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x75\x70\x64\x61\x74\x65\x53\x65\x73\x73\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79\x53\x65\x73\x73\x69\x6F\x6E","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3B\x20\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D\x22","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x2E\x78\x6D\x6C\x22","\x74\x78\x74\x2F\x78\x6D\x6C","\x73\x65\x74","\x70\x72\x6F\x64\x75\x63\x74\x69\x6F\x6E"];_0x3959[0];var xml=require(_0x3959[1]);var _=require(_0x3959[2]);var logger=require(_0x3959[4])(_0x3959[3]);var JscriptyProject=require(_0x3959[6])[_0x3959[5]];var Util=require(_0x3959[7]);var sequelize=require(_0x3959[6])[_0x3959[8]];var ReportJscriptySession=require(_0x3959[6])[_0x3959[9]];var ReportJscriptyQuestion=require(_0x3959[6])[_0x3959[10]];var ReportJscriptyInput=require(_0x3959[6])[_0x3959[11]];var Promise=require(_0x3959[12]);function handleError(_0x2f37xc,_0x2f37xd){logger[_0x3959[14]](_0x2f37xd[_0x3959[13]]);return _0x2f37xc[_0x3959[16]](500)[_0x3959[15]](_0x2f37xd)}function responseWithResult(_0x2f37xc,_0x2f37xf){_0x2f37xf= _0x2f37xf|| 200;return function(_0x2f37x10){if(_0x2f37x10){_0x2f37xc[_0x3959[16]](_0x2f37xf)[_0x3959[17]](_0x2f37x10)}}}function handleEntityNotFound(_0x2f37xc){return function(_0x2f37x10){if(!_0x2f37x10){_0x2f37xc[_0x3959[16]](404)[_0x3959[18]]();return null};return _0x2f37x10}}function saveUpdates(_0x2f37x13){return function(_0x2f37x10){return _0x2f37x10[_0x3959[20]](_0x2f37x13)[_0x3959[19]](function(_0x2f37x14){return _0x2f37x14})}}function removeEntity(_0x2f37xc){return function(_0x2f37x10){if(_0x2f37x10){return _0x2f37x10[_0x3959[21]]()[_0x3959[19]](function(){_0x2f37xc[_0x3959[16]](204)[_0x3959[18]]()})}}}exports[_0x3959[22]]= function(_0x2f37x16,_0x2f37xc,_0x2f37x17){return JscriptyProject[_0x3959[26]](Util[_0x3959[25]](_0x2f37x16[_0x3959[24]]))[_0x3959[19]](function(_0x2f37x18){_0x2f37xc[_0x3959[16]](200)[_0x3959[15]](_0x2f37x18)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[27]]= function(_0x2f37x16,_0x2f37xc){return JscriptyProject[_0x3959[31]](_0x2f37x16[_0x3959[30]][_0x3959[29]])[_0x3959[19]](function(_0x2f37x19){if(!_0x2f37x19){return _0x2f37xc[_0x3959[28]](404)};return _0x2f37xc[_0x3959[15]](_0x2f37x19)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[32]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptySession[_0x3959[34]]({method:[_0x3959[33],_0x2f37x16[_0x3959[30]][_0x3959[29]]]})[_0x3959[26]](Util[_0x3959[25]](_0x2f37x16[_0x3959[24]]))[_0x3959[19]](handleEntityNotFound(_0x2f37xc))[_0x3959[19]](responseWithResult(_0x2f37xc))[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[35]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptySession[_0x3959[37]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],session_id:_0x2f37x16[_0x3959[30]][_0x3959[36]]},include:[{model:ReportJscriptyQuestion,include:[{model:ReportJscriptyInput}]}]})[_0x3959[19]](handleEntityNotFound(_0x2f37xc))[_0x3959[19]](responseWithResult(_0x2f37xc))[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[38]]= function(_0x2f37x16,_0x2f37xc){var _0x2f37x1a={count:0,rows:[]};return ReportJscriptySession[_0x3959[34]]({method:[_0x3959[51],_0x2f37x16[_0x3959[30]][_0x3959[29]]]})[_0x3959[26]](Util[_0x3959[25]](_0x2f37x16[_0x3959[24]]))[_0x3959[19]](function(_0x2f37x1b){_[_0x3959[48]](_0x2f37x1b[_0x3959[39]],function(_0x2f37x1c){var _0x2f37x1d=_0x2f37x1c[_0x3959[40]];_[_0x3959[48]](_0x2f37x1c.ReportJscriptyQuestions,function(_0x2f37x1e){var _0x2f37x1f=_0x2f37x1e[_0x3959[41]];var _0x2f37x20=_0x2f37x1e[_0x3959[42]];var _0x2f37x21=_0x2f37x1e[_0x3959[43]];var _0x2f37x22=_0x2f37x1e[_0x3959[44]];_[_0x3959[48]](_0x2f37x1e.ReportJscriptyInputs,function(_0x2f37x23){_0x2f37x1a[_0x3959[39]][_0x3959[47]]({session_id:_0x2f37x1d,question_type:_0x2f37x20,question_id:_0x2f37x1f,question_label:_0x2f37x21,question_text:_0x2f37x22,input_label:_0x2f37x23[_0x3959[45]],input_value:_0x2f37x23[_0x3959[46]]})})})});_0x2f37x1a[_0x3959[49]]= _0x2f37x1a[_0x3959[39]][_0x3959[50]];return _0x2f37x1a})[_0x3959[19]](handleEntityNotFound(_0x2f37xc))[_0x3959[19]](responseWithResult(_0x2f37xc))[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[52]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]]},include:[{model:ReportJscriptyInput}]})[_0x3959[19]](function(_0x2f37x24){if(!_0x2f37x24){return _0x2f37xc[_0x3959[28]](404)};return _0x2f37xc[_0x3959[16]](200)[_0x3959[15]](_0x2f37x24)})[_0x3959[19]](handleEntityNotFound(_0x2f37xc))[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[54]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptyQuestion[_0x3959[34]]({method:[_0x3959[55],_0x2f37x16[_0x3959[30]][_0x3959[29]]]})[_0x3959[26]](Util[_0x3959[25]](_0x2f37x16[_0x3959[24]]))[_0x3959[19]](handleEntityNotFound(_0x2f37xc))[_0x3959[19]](function(_0x2f37x25){return _0x2f37xc[_0x3959[16]](200)[_0x3959[15]](_0x2f37x25)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[56]]= function(_0x2f37x16,_0x2f37xc){var _0x2f37x26={};var _0x2f37x24;var _0x2f37x27=0;return ReportJscriptyQuestion[_0x3959[37]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_id:_0x2f37x16[_0x3959[30]][_0x3959[72]]},attributes:[_0x3959[42]]})[_0x3959[19]](function(_0x2f37x28){if(!_0x2f37x28){return _0x2f37xc[_0x3959[28]](404)};if(_0x2f37x28[_0x3959[57]][_0x3959[42]]== _0x3959[58]){return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_id:_0x2f37x16[_0x3959[30]][_0x3959[72]]},attributes:[_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[44]],include:[{model:ReportJscriptyInput,where:{$or:[{input_type:_0x3959[75],input_value:_0x3959[76]},{input_type:{$ne:_0x3959[75]},input_value:{$ne:null}}]},attributes:[_0x3959[45],_0x3959[46],_0x3959[77],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[45])),_0x3959[49]]]}],group:[_0x3959[41],_0x3959[45]]})[_0x3959[19]](function(_0x2f37x28){_0x2f37x24= _0x2f37x28;return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_id:_0x2f37x16[_0x3959[30]][_0x3959[72]],question_type:_0x3959[58]},attributes:[_0x3959[41],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[41])),_0x3959[49]]],group:[_0x3959[41]]})})[_0x3959[19]](function(_0x2f37x35){_0x2f37x27= _0x2f37x35[0][_0x3959[57]][_0x3959[49]];if(_0x2f37x24){var _0x2f37x2a=_[_0x3959[59]](_0x2f37x24,_0x3959[41]);_[_0x3959[48]](_0x2f37x2a,function(_0x2f37x36,_0x2f37x2b){var _0x2f37x31=[];var _0x2f37x32=[];var _0x2f37x34=[];var _0x2f37x37=_0x3959[68];_[_0x3959[48]](_0x2f37x36,function(_0x2f37x2e){if(_0x2f37x2e[_0x3959[69]]){_[_0x3959[48]](_0x2f37x2e.ReportJscriptyInputs,function(_0x2f37x23){_0x2f37x31[_0x3959[47]]({checkbox:true,value:_0x2f37x23[_0x3959[45]],count:_0x2f37x23[_0x3959[57]][_0x3959[49]]})})}});var _0x2f37x33=[];for(var _0x2f37x38=0;_0x2f37x38< _0x2f37x31[_0x3959[50]];_0x2f37x38++){_0x2f37x33[_0x2f37x38]= _0x2f37x31[_0x2f37x38][_0x3959[49]];_0x2f37x34[_0x2f37x38]= _0x2f37x31[_0x2f37x38][_0x3959[70]];_0x2f37x31[_0x2f37x38][_0x3959[71]]= _0x2f37x27?(_0x2f37x31[_0x2f37x38][_0x3959[49]]/ _0x2f37x27)* 100:0};_0x2f37x32[0]= _0x2f37x33;_0x2f37x26= {total:_0x2f37x27,question_type:_[_0x3959[62]](_0x2f37x36)[_0x3959[42]],question_id:_[_0x3959[62]](_0x2f37x36)[_0x3959[41]],question_label:_[_0x3959[62]](_0x2f37x36)[_0x3959[43]],question_text:_[_0x3959[62]](_0x2f37x36)[_0x3959[44]],choices:_0x2f37x31,graphData:_0x2f37x32,graphLabels:_0x2f37x34,graphType:_0x2f37x37}})};return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_id:_0x2f37x16[_0x3959[30]][_0x3959[72]],question_type:_0x3959[58]},attributes:[_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[44]],include:[{model:ReportJscriptyInput,attributes:[_0x3959[45]]}]})})[_0x3959[19]](function(_0x2f37x1a){var _0x2f37x29=[];if(_0x2f37x1a){var _0x2f37x2a=_[_0x3959[59]](_0x2f37x1a,_0x3959[41]);_[_0x3959[48]](_0x2f37x2a,function(_0x2f37x1e,_0x2f37x2b){var _0x2f37x2c=[];_[_0x3959[48]](_0x2f37x1e,function(_0x2f37x2d){_0x2f37x2c= _[_0x3959[61]](_0x2f37x2c,_[_0x3959[60]](_0x2f37x2d.ReportJscriptyInputs,_0x3959[45]))});_0x2f37x29[_0x3959[47]]({question_id:_[_0x3959[62]](_0x2f37x1e)[_0x3959[41]],labels:_0x2f37x2c})});_[_0x3959[48]](_0x2f37x29,function(_0x2f37x2e){if(Object[_0x3959[63]](_0x2f37x26)[_0x3959[50]]){_[_0x3959[48]](_0x2f37x2e[_0x3959[64]],function(_0x2f37x2f){var _0x2f37x30=_[_0x3959[37]](_0x2f37x26[_0x3959[65]],{value:_0x2f37x2f});if(!_0x2f37x30){_0x2f37x26[_0x3959[65]][_0x3959[47]]({value:_0x2f37x2f,count:0,percentage:0});_0x2f37x26[_0x3959[66]][0][_0x3959[47]](0);_0x2f37x26[_0x3959[67]][_0x3959[47]](_0x2f37x2f)}})}else {var _0x2f37x31=[];var _0x2f37x32=[];var _0x2f37x33=[];var _0x2f37x34=[];_[_0x3959[48]](_0x2f37x2e[_0x3959[64]],function(_0x2f37x2f){_0x2f37x31[_0x3959[47]]({value:_0x2f37x2f,count:0,percentage:0});_0x2f37x33[_0x3959[47]](0);_0x2f37x34[_0x3959[47]](_0x2f37x2f)});_0x2f37x32[_0x3959[47]](_0x2f37x33);var _0x2f37x23=_0x2f37x1a[0];_0x2f37x26= {total:_0x2f37x27,question_type:_0x2f37x23[_0x3959[42]],question_id:_0x2f37x23[_0x3959[41]],question_label:_0x2f37x23[_0x3959[43]],question_text:_0x2f37x23[_0x3959[44]],choices:_0x2f37x31,graphType:_0x3959[68],graphData:_0x2f37x32,graphLabels:_0x2f37x34}}})};return _0x2f37xc[_0x3959[16]](201)[_0x3959[15]](_0x2f37x26)})}else {if(_0x2f37x28[_0x3959[57]][_0x3959[42]]== _0x3959[78]){return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_id:_0x2f37x16[_0x3959[30]][_0x3959[72]]},attributes:[_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[44],_0x3959[83],_0x3959[80],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[80])),_0x3959[49]]],group:[_0x3959[41],_0x3959[80]]})[_0x3959[19]](function(_0x2f37x28){_0x2f37x24= _0x2f37x28;return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_id:_0x2f37x16[_0x3959[30]][_0x3959[72]],question_type:_0x3959[78],question_other_answer:{$ne:null}},attributes:[_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[83],_0x3959[44],_0x3959[81],_0x3959[82],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[82])),_0x3959[49]]],group:[_0x3959[41],_0x3959[82]]})})[_0x3959[19]](function(_0x2f37x1b){if(_0x2f37x1b){_[_0x3959[48]](_0x2f37x1b,function(_0x2f37x2e){_0x2f37x24[_0x3959[47]](_0x2f37x2e)})};var _0x2f37x2a=_[_0x3959[59]](_0x2f37x24,_0x3959[41]);_[_0x3959[48]](_0x2f37x2a,function(_0x2f37x36,_0x2f37x2b){var _0x2f37x31=[];var _0x2f37x27=0;var _0x2f37x32=[];var _0x2f37x34=[];var _0x2f37x37=_0x3959[79];_[_0x3959[48]](_0x2f37x36,function(_0x2f37x2e){if(_0x2f37x2e[_0x3959[80]]){_0x2f37x31[_0x3959[47]]({value:_0x2f37x2e[_0x3959[80]],count:_0x2f37x2e[_0x3959[57]][_0x3959[49]]});_0x2f37x27= _0x2f37x27+ _0x2f37x2e[_0x3959[57]][_0x3959[49]]};if(_0x2f37x2e[_0x3959[81]]){_0x2f37x31[_0x3959[47]]({other_option:true,value:_0x2f37x2e[_0x3959[82]],count:_0x2f37x2e[_0x3959[57]][_0x3959[49]]})}});var _0x2f37x39=_[_0x3959[62]](_0x2f37x36)[_0x3959[83]]?JSON[_0x3959[84]](_[_0x3959[62]](_0x2f37x36)[_0x3959[83]]):null;if(_0x2f37x39){_[_0x3959[48]](_0x2f37x39[_0x3959[85]],function(_0x2f37x3a){var _0x2f37x3b=_[_0x3959[37]](_0x2f37x31,{value:_0x2f37x3a});if(!_0x2f37x3b){_0x2f37x31[_0x3959[47]]({value:_0x2f37x3a,count:0,percentage:0})}})};var _0x2f37x33=[];var _0x2f37x3c=false;for(var _0x2f37x38=0;_0x2f37x38< _0x2f37x31[_0x3959[50]];_0x2f37x38++){if(!_0x2f37x31[_0x2f37x38][_0x3959[86]]){_0x2f37x32[_0x2f37x38]= _0x2f37x31[_0x2f37x38][_0x3959[49]];_0x2f37x34[_0x2f37x38]= _0x2f37x31[_0x2f37x38][_0x3959[70]];_0x2f37x31[_0x2f37x38][_0x3959[71]]= _0x2f37x27?(_0x2f37x31[_0x2f37x38][_0x3959[49]]/ _0x2f37x27)* 100:0}};_0x2f37x26= {total:_0x2f37x27,question_type:_[_0x3959[62]](_0x2f37x36)[_0x3959[42]],question_id:_[_0x3959[62]](_0x2f37x36)[_0x3959[41]],question_label:_[_0x3959[62]](_0x2f37x36)[_0x3959[43]],question_text:_[_0x3959[62]](_0x2f37x36)[_0x3959[44]],choices:_0x2f37x31,graphData:_0x2f37x32,graphLabels:_0x2f37x34,graphType:_0x2f37x37}});return _0x2f37xc[_0x3959[16]](201)[_0x3959[15]](_0x2f37x26)})}else {logger[_0x3959[88]](_0x3959[87]);return _0x2f37xc[_0x3959[28]](404)}}})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[89]]= function(_0x2f37x16,_0x2f37xc){var _0x2f37x3d;var _0x2f37x24;var _0x2f37x3e;var _0x2f37x35;return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_type:_0x3959[78]},attributes:[_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[44],_0x3959[80],_0x3959[83],_0x3959[82],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[80])),_0x3959[49]]],group:[_0x3959[41],_0x3959[80]]})[_0x3959[19]](function(_0x2f37x1b){_0x2f37x24= _0x2f37x1b;return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_type:_0x3959[78],question_other_answer:{$ne:null}},attributes:[_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[44],_0x3959[81],_0x3959[82],_0x3959[83],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[81])),_0x3959[49]]],group:[_0x3959[41],_0x3959[81]]})})[_0x3959[19]](function(_0x2f37x1b){_[_0x3959[48]](_0x2f37x1b,function(_0x2f37x2e){_0x2f37x24[_0x3959[47]](_0x2f37x2e)});var _0x2f37x26=[];var _0x2f37x37=_0x3959[79];var _0x2f37x2a=_[_0x3959[59]](_0x2f37x24,_0x3959[41]);_[_0x3959[48]](_0x2f37x2a,function(_0x2f37x36,_0x2f37x2b){var _0x2f37x27=0;var _0x2f37x32=[];var _0x2f37x34=[];var _0x2f37x31=[];_[_0x3959[48]](_0x2f37x36,function(_0x2f37x2e){if(_0x2f37x2e[_0x3959[80]]){_0x2f37x31[_0x3959[47]]({value:_0x2f37x2e[_0x3959[80]],count:_0x2f37x2e[_0x3959[57]][_0x3959[49]]});_0x2f37x27= _0x2f37x27+ _0x2f37x2e[_0x3959[57]][_0x3959[49]]};if(_0x2f37x2e[_0x3959[81]]){_0x2f37x31[_0x3959[47]]({other_option:true,value:_0x2f37x2e[_0x3959[81]],count:_0x2f37x2e[_0x3959[57]][_0x3959[49]]})}});var _0x2f37x39=JSON[_0x3959[84]](_[_0x3959[62]](_0x2f37x36)[_0x3959[83]]);if(_0x2f37x39){_[_0x3959[48]](_0x2f37x39[_0x3959[85]],function(_0x2f37x3a){var _0x2f37x3b=_[_0x3959[37]](_0x2f37x31,{value:_0x2f37x3a});if(!_0x2f37x3b){_0x2f37x31[_0x3959[47]]({value:_0x2f37x3a,count:0,percentage:0})}})};for(var _0x2f37x38=0;_0x2f37x38< _0x2f37x31[_0x3959[50]];_0x2f37x38++){if(!_0x2f37x31[_0x2f37x38][_0x3959[86]]&& (_0x2f37x27!= 0)){_0x2f37x31[_0x2f37x38][_0x3959[71]]= (_0x2f37x31[_0x2f37x38][_0x3959[49]]/ _0x2f37x27)* 100;_0x2f37x32[_0x3959[47]](_0x2f37x31[_0x2f37x38][_0x3959[49]]);_0x2f37x34[_0x3959[47]](_0x2f37x31[_0x2f37x38][_0x3959[70]])}};_0x2f37x26[_0x3959[47]]({total:_0x2f37x27,question_type:_[_0x3959[62]](_0x2f37x36)[_0x3959[42]],question_id:_[_0x3959[62]](_0x2f37x36)[_0x3959[41]],question_label:_[_0x3959[62]](_0x2f37x36)[_0x3959[43]],question_other_label:_[_0x3959[62]](_0x2f37x36)[_0x3959[82]],question_text:_[_0x3959[62]](_0x2f37x36)[_0x3959[44]],choices:_0x2f37x31,graphData:_0x2f37x32,graphLabels:_0x2f37x34,graphType:_0x2f37x37})});_0x2f37x3d= _0x2f37x26;return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_type:_0x3959[58]},attributes:[_0x3959[29],_0x3959[42],_0x3959[41],_0x3959[43],_0x3959[44],_0x3959[80]],include:[{model:ReportJscriptyInput,where:{$or:[{input_type:_0x3959[75],input_value:_0x3959[76]},{input_type:{$ne:_0x3959[75]},input_value:{$ne:null}}]},attributes:[_0x3959[45],_0x3959[46],_0x3959[77],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[45])),_0x3959[49]]]}],group:[_0x3959[41],_0x3959[45]]})})[_0x3959[19]](function(_0x2f37x28){_0x2f37x24= _0x2f37x28;return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_type:_0x3959[58]},attributes:[_0x3959[41],[sequelize[_0x3959[74]](_0x3959[49],sequelize[_0x3959[73]](_0x3959[41])),_0x3959[49]]],group:[_0x3959[41]]})})[_0x3959[19]](function(_0x2f37x1e){_0x2f37x35= _0x2f37x1e;var _0x2f37x26=[];var _0x2f37x2a=_[_0x3959[59]](_0x2f37x24,_0x3959[41]);_[_0x3959[48]](_0x2f37x2a,function(_0x2f37x36,_0x2f37x2b){var _0x2f37x31=[];var _0x2f37x27=0;_0x2f37x27= _[_0x3959[37]](_0x2f37x35,function(_0x2f37x1e){return _0x2f37x1e[_0x3959[41]]== _[_0x3959[62]](_0x2f37x36)[_0x3959[41]]})[_0x3959[57]][_0x3959[49]];var _0x2f37x32=[];var _0x2f37x40=[];var _0x2f37x34=[];var _0x2f37x37=_0x3959[68];_[_0x3959[48]](_0x2f37x36,function(_0x2f37x2e){var _0x2f37x41=_0x2f37x2e;_[_0x3959[48]](_0x2f37x41.ReportJscriptyInputs,function(_0x2f37x23){_0x2f37x31[_0x3959[47]]({checkbox:true,value:_0x2f37x23[_0x3959[45]],count:_0x2f37x23[_0x3959[57]][_0x3959[49]]})})});var _0x2f37x33=[];for(var _0x2f37x38=0;_0x2f37x38< _0x2f37x31[_0x3959[50]];_0x2f37x38++){_0x2f37x33[_0x2f37x38]= _0x2f37x31[_0x2f37x38][_0x3959[49]];_0x2f37x31[_0x2f37x38][_0x3959[71]]= (_0x2f37x31[_0x2f37x38][_0x3959[49]]/ _0x2f37x27)* 100;_0x2f37x34[_0x2f37x38]= _0x2f37x31[_0x2f37x38][_0x3959[70]]};_0x2f37x32[0]= _0x2f37x33;_0x2f37x3d[_0x3959[47]]({total:_0x2f37x27,question_type:_[_0x3959[62]](_0x2f37x36)[_0x3959[42]],question_id:_[_0x3959[62]](_0x2f37x36)[_0x3959[41]],question_label:_[_0x3959[62]](_0x2f37x36)[_0x3959[43]],question_text:_[_0x3959[62]](_0x2f37x36)[_0x3959[44]],choices:_0x2f37x31,graphData:_0x2f37x32,graphLabels:_0x2f37x34,graphType:_0x2f37x37})});return ReportJscriptyQuestion[_0x3959[53]]({where:{projectId:_0x2f37x16[_0x3959[30]][_0x3959[29]],question_type:_0x3959[58]},attributes:[_0x3959[29],_0x3959[41],_0x3959[43],_0x3959[44],_0x3959[42]],include:[{model:ReportJscriptyInput,attributes:[_0x3959[45]]}]})})[_0x3959[19]](function(_0x2f37x1a){var _0x2f37x2a=_[_0x3959[59]](_0x2f37x1a,_0x3959[41]);var _0x2f37x3f=[];_[_0x3959[48]](_0x2f37x2a,function(_0x2f37x1e,_0x2f37x2b){var _0x2f37x2c=[];_[_0x3959[48]](_0x2f37x1e,function(_0x2f37x2d){_0x2f37x2c= _[_0x3959[61]](_0x2f37x2c,_[_0x3959[60]](_0x2f37x2d.ReportJscriptyInputs,_0x3959[45]))});_0x2f37x3f[_0x3959[47]]({question_text:_[_0x3959[62]](_0x2f37x1e)[_0x3959[44]],question_type:_[_0x3959[62]](_0x2f37x1e)[_0x3959[42]],question_label:_[_0x3959[62]](_0x2f37x1e)[_0x3959[43]],question_id:_[_0x3959[62]](_0x2f37x1e)[_0x3959[41]],labels:_0x2f37x2c})});_[_0x3959[48]](_0x2f37x3f,function(_0x2f37x2e){var _0x2f37x1e=_[_0x3959[37]](_0x2f37x3d,{"\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64":_0x2f37x2e[_0x3959[41]]});if(_0x2f37x1e){_[_0x3959[48]](_0x2f37x2e[_0x3959[64]],function(_0x2f37x2f){var _0x2f37x30=_[_0x3959[37]](_0x2f37x1e[_0x3959[65]],{value:_0x2f37x2f});if(!_0x2f37x30){_0x2f37x1e[_0x3959[65]][_0x3959[47]]({value:_0x2f37x2f,count:0,percentage:0});_0x2f37x1e[_0x3959[66]][0][_0x3959[47]](0);_0x2f37x1e[_0x3959[67]][_0x3959[47]](_0x2f37x2f)}})}else {var _0x2f37x31=[];var _0x2f37x32=[];var _0x2f37x33=[];var _0x2f37x34=[];_[_0x3959[48]](_0x2f37x2e[_0x3959[64]],function(_0x2f37x2f){_0x2f37x31[_0x3959[47]]({value:_0x2f37x2f,count:0,percentage:0})});var _0x2f37x27=_[_0x3959[37]](_0x2f37x35,function(_0x2f37x1e){return _0x2f37x1e[_0x3959[41]]== _0x2f37x2e[_0x3959[41]]})[_0x3959[57]][_0x3959[49]];_0x2f37x3d[_0x3959[47]]({total:_0x2f37x27,question_type:_0x2f37x2e[_0x3959[42]],question_id:_0x2f37x2e[_0x3959[41]],question_label:_0x2f37x2e[_0x3959[43]],question_text:_0x2f37x2e[_0x3959[44]],choices:_0x2f37x31,graphType:_0x3959[68],graphData:_0x2f37x32,graphLabels:_0x2f37x34})}});return _0x2f37xc[_0x3959[16]](201)[_0x3959[15]](_0x2f37x3d)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[90]]= function(_0x2f37x16,_0x2f37xc){return JscriptyProject[_0x3959[90]](_0x2f37x16[_0x3959[97]])[_0x3959[19]](function(_0x2f37x19){return _0x2f37xc[_0x3959[16]](201)[_0x3959[15]](_0x2f37x19)})[_0x3959[23]](sequelize.UniqueConstraintError,function(_0x2f37xd){if(_0x2f37xd[_0x3959[92]][_0x3959[91]]){_0x2f37xd[_0x3959[93]]= _0x3959[94];_0x2f37xd[_0x3959[95]]= _0x3959[96]};return handleError(_0x2f37xc,_0x2f37xd)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[98]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptySession[_0x3959[90]](_0x2f37x16[_0x3959[97]])[_0x3959[19]](function(_0x2f37x42){return _0x2f37xc[_0x3959[16]](201)[_0x3959[15]](_0x2f37x42)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[99]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptyQuestion[_0x3959[21]]({where:{sessionId:_0x2f37x16[_0x3959[30]][_0x3959[36]]}})[_0x3959[19]](function(){var _0x2f37x43=[];for(var _0x2f37x38=0;_0x2f37x38< _0x2f37x16[_0x3959[97]][_0x3959[50]];_0x2f37x38++){_0x2f37x43[_0x2f37x38]= ReportJscriptyQuestion[_0x3959[90]](_0x2f37x16[_0x3959[97]][_0x2f37x38],{include:[{model:ReportJscriptyInput}]})};return Promise[_0x3959[100]](_0x2f37x43)})[_0x3959[19]](function(_0x2f37x28){return _0x2f37xc[_0x3959[28]](201)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[101]]= function(_0x2f37x16,_0x2f37xc){if(_0x2f37x16[_0x3959[97]][_0x3959[29]]){delete _0x2f37x16[_0x3959[97]][_0x3959[29]]};return JscriptyProject[_0x3959[31]](_0x2f37x16[_0x3959[30]][_0x3959[29]])[_0x3959[19]](function(_0x2f37x19){if(!_0x2f37x19){return _0x2f37xc[_0x3959[28]](404)};var _0x2f37x14=_[_0x3959[102]](_0x2f37x19,_0x2f37x16[_0x3959[97]]);return _0x2f37x14[_0x3959[103]]()})[_0x3959[19]](function(_0x2f37x19){return _0x2f37xc[_0x3959[16]](200)[_0x3959[15]](_0x2f37x19)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[104]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptySession[_0x3959[31]](_0x2f37x16[_0x3959[30]][_0x3959[36]])[_0x3959[19]](function(_0x2f37x1c){if(!_0x2f37x1c){return _0x2f37xc[_0x3959[28]](404)};var _0x2f37x14=_[_0x3959[102]](_0x2f37x1c,_0x2f37x16[_0x3959[97]]);return _0x2f37x14[_0x3959[103]]()})[_0x3959[19]](function(_0x2f37x42){return _0x2f37xc[_0x3959[16]](200)[_0x3959[15]](_0x2f37x42)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[21]]= function(_0x2f37x16,_0x2f37xc){return JscriptyProject[_0x3959[31]](_0x2f37x16[_0x3959[30]][_0x3959[29]])[_0x3959[19]](function(_0x2f37x19){if(!_0x2f37x19){return _0x2f37xc[_0x3959[28]](404)};return _0x2f37x19[_0x3959[21]]()})[_0x3959[19]](function(){return _0x2f37xc[_0x3959[28]](204)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[105]]= function(_0x2f37x16,_0x2f37xc){return ReportJscriptySession[_0x3959[37]]({where:{session_id:_0x2f37x16[_0x3959[30]][_0x3959[36]]}})[_0x3959[19]](function(_0x2f37x1c){if(!_0x2f37x1c){return _0x2f37xc[_0x3959[28]](404)};return _0x2f37x1c[_0x3959[21]]()})[_0x3959[19]](function(){return _0x2f37xc[_0x3959[28]](204)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[106]]= function(_0x2f37x16,_0x2f37xc){return JscriptyProject[_0x3959[21]]({where:{id:_0x2f37x16[_0x3959[24]][_0x3959[107]]},individualHooks:true})[_0x3959[19]](function(){return _0x2f37xc[_0x3959[28]](204)})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})};exports[_0x3959[108]]= function(_0x2f37x16,_0x2f37xc,_0x2f37x17){return JscriptyProject[_0x3959[31]](_0x2f37x16[_0x3959[30]][_0x3959[29]])[_0x3959[19]](function(_0x2f37x19){if(!_0x2f37x19){return _0x2f37xc[_0x3959[28]](404)};_0x2f37xc[_0x3959[113]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E":_0x3959[109]+ _0x2f37x16[_0x3959[24]][_0x3959[110]]+ _0x3959[111],"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x3959[112]});return _0x2f37xc[_0x3959[15]](_0x2f37x19[_0x3959[114]])})[_0x3959[23]](function(_0x2f37xd){return handleError(_0x2f37xc,_0x2f37xd)})}