Built motion from commit 8d91b1b.|0.0.64
[motion.git] / server / api / jscripty_project / jscripty_project.controller.js
1 var _0x8354=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x78\x6D\x6C\x32\x6A\x73","\x6C\x6F\x64\x61\x73\x68","\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\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","\x6C\x6F\x67","\x71\x75\x65\x73\x74\x69\x6F\x6E\x73\x41\x6E\x64\x49\x6E\x70\x75\x74","\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\x41\x6C\x6C","\x73\x68\x6F\x77\x51\x75\x65\x73\x74\x69\x6F\x6E\x73","\x73\x68\x6F\x77\x53\x75\x6D\x6D\x61\x72\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64","\x73\x68\x6F\x77\x44\x65\x74\x61\x69\x6C","\x72\x6F\x77\x73","\x63\x6F\x75\x6E\x74","\x66\x6F\x72\x45\x61\x63\x68","\x66\x69\x6C\x74\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\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\x63\x6F\x75\x6E\x74","\x67\x72\x6F\x75\x70\x42\x79","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x6C\x61\x62\x65\x6C","\x66\x69\x72\x73\x74","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x74\x65\x78\x74","\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x61\x6E\x73\x77\x65\x72","\x6D\x61\x70","\x70\x75\x73\x68","\x71\x75\x65\x73\x74\x69\x6F\x6E","\x70\x72\x6F\x6A\x65\x63\x74\x49\x64","\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","\x72\x65\x71\x2E\x62\x6F\x64\x79","\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","\x66\x69\x6E\x64","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3B\x20\x66\x69\x6C\x65\x6E\x61\x6D\x65\x3D\x22","\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"];_0x8354[0];var xml=require(_0x8354[1]);var _=require(_0x8354[2]);var JscriptyProject=require(_0x8354[4])[_0x8354[3]];var Util=require(_0x8354[5]);var sequelize=require(_0x8354[4])[_0x8354[6]];var ReportJscriptySession=require(_0x8354[4])[_0x8354[7]];var ReportJscriptyQuestion=require(_0x8354[4])[_0x8354[8]];var ReportJscriptyInput=require(_0x8354[4])[_0x8354[9]];var Promise=require(_0x8354[10]);function handleError(_0x7e52xb,_0x7e52xc){return _0x7e52xb[_0x8354[12]](500)[_0x8354[11]](_0x7e52xc)}function responseWithResult(_0x7e52xb,_0x7e52xe){_0x7e52xe=_0x7e52xe||200;return function(_0x7e52xf){if(_0x7e52xf){_0x7e52xb[_0x8354[12]](_0x7e52xe)[_0x8354[13]](_0x7e52xf)}}}function handleEntityNotFound(_0x7e52xb){return function(_0x7e52xf){if(!_0x7e52xf){_0x7e52xb[_0x8354[12]](404)[_0x8354[14]]();return null};return _0x7e52xf}}function saveUpdates(_0x7e52x12){return function(_0x7e52xf){return _0x7e52xf[_0x8354[16]](_0x7e52x12)[_0x8354[15]](function(_0x7e52x13){return _0x7e52x13})}}function removeEntity(_0x7e52xb){return function(_0x7e52xf){if(_0x7e52xf){return _0x7e52xf[_0x8354[17]]()[_0x8354[15]](function(){_0x7e52xb[_0x8354[12]](204)[_0x8354[14]]()})}}}exports[_0x8354[18]]=function(_0x7e52x15,_0x7e52xb,_0x7e52x16){return JscriptyProject[_0x8354[22]](Util[_0x8354[21]](_0x7e52x15[_0x8354[20]]))[_0x8354[15]](function(_0x7e52x17){_0x7e52xb[_0x8354[12]](200)[_0x8354[11]](_0x7e52x17)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[23]]=function(_0x7e52x15,_0x7e52xb){return JscriptyProject[_0x8354[27]](_0x7e52x15[_0x8354[26]][_0x8354[25]])[_0x8354[15]](function(_0x7e52x18){if(!_0x7e52x18){return _0x7e52xb[_0x8354[24]](404)};return _0x7e52xb[_0x8354[11]](_0x7e52x18)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[28]]=function(_0x7e52x15,_0x7e52xb){return ReportJscriptySession[_0x8354[31]]({method:[_0x8354[30],_0x7e52x15[_0x8354[26]][_0x8354[25]]]})[_0x8354[22]](Util[_0x8354[21]](_0x7e52x15[_0x8354[20]]))[_0x8354[15]](handleEntityNotFound(_0x7e52xb))[_0x8354[15]](responseWithResult(_0x7e52xb))[_0x8354[19]](function(_0x7e52xc){console[_0x8354[29]](_0x7e52xc);return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[32]]=function(_0x7e52x15,_0x7e52xb){return ReportJscriptySession[_0x8354[34]]({where:{projectId:_0x7e52x15[_0x8354[26]][_0x8354[25]],session_id:_0x7e52x15[_0x8354[26]][_0x8354[33]]},include:[{model:ReportJscriptyQuestion,include:[{model:ReportJscriptyInput}]}]})[_0x8354[15]](handleEntityNotFound(_0x7e52xb))[_0x8354[15]](responseWithResult(_0x7e52xb))[_0x8354[19]](function(_0x7e52xc){console[_0x8354[29]](_0x7e52xc);return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[35]]=function(_0x7e52x15,_0x7e52xb){return ReportJscriptyQuestion[_0x8354[34]]({where:{projectId:_0x7e52x15[_0x8354[26]][_0x8354[25]]},include:[{model:ReportJscriptyInput}]})[_0x8354[15]](function(_0x7e52x19){if(!_0x7e52x19){return _0x7e52xb[_0x8354[24]](404)};return _0x7e52xb[_0x8354[12]](200)[_0x8354[11]](_0x7e52x19)})[_0x8354[15]](handleEntityNotFound(_0x7e52xb))[_0x8354[19]](function(_0x7e52xc){console[_0x8354[29]](_0x7e52xc);return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[36]]=function(_0x7e52x15,_0x7e52xb){return ReportJscriptyQuestion[_0x8354[22]]({where:{projectId:_0x7e52x15[_0x8354[26]][_0x8354[25]]},group:_0x8354[37]})[_0x8354[15]](handleEntityNotFound(_0x7e52xb))[_0x8354[15]](function(_0x7e52x1a){return _0x7e52xb[_0x8354[12]](200)[_0x8354[11]](_0x7e52x1a)})[_0x8354[19]](function(_0x7e52xc){console[_0x8354[29]](_0x7e52xc);return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[38]]=function(_0x7e52x15,_0x7e52xb){var _0x7e52x1b;return ReportJscriptyQuestion[_0x8354[22]]({where:{projectId:_0x7e52x15[_0x8354[26]][_0x8354[25]],question_type:_0x8354[54]},attributes:[_0x8354[55],_0x8354[37],_0x8354[48],_0x8354[50],_0x8354[51],_0x8354[44],_0x8354[45]],group:[_0x8354[37],_0x8354[51]]})[_0x8354[15]](function(_0x7e52x19){var _0x7e52x24=[];_[_0x8354[41]](_0x7e52x19[_0x8354[39]],function(_0x7e52x1c,_0x7e52x1d){_0x7e52x19[_0x8354[39]][_0x7e52x1d][_0x8354[40]]=_0x7e52x19[_0x8354[40]][_0x7e52x1d][_0x8354[40]]});var _0x7e52x25=_[_0x8354[47]](_0x7e52x19[_0x8354[39]],_0x8354[37]);_[_0x8354[41]](_0x7e52x25,function(_0x7e52x1c,_0x7e52x1d){var _0x7e52x26={question_id:_0x7e52x1d,question_label:_[_0x8354[49]](_0x7e52x1c)[_0x8354[48]],question_text:_[_0x8354[49]](_0x7e52x1c)[_0x8354[50]],question_answers:_[_0x8354[52]](_0x7e52x1c,_0x8354[51]),count:_[_0x8354[52]](_0x7e52x1c,_0x8354[40])};_0x7e52x24[_0x8354[53]](_0x7e52x26)});_0x7e52x1b=_0x7e52x24;return ReportJscriptyQuestion[_0x8354[22]]({where:{projectId:_0x7e52x15[_0x8354[26]][_0x8354[25]],question_type:_0x8354[54]},group:[_0x8354[37],_0x8354[45]]})})[_0x8354[15]](function(_0x7e52x19){_[_0x8354[41]](_0x7e52x19[_0x8354[39]],function(_0x7e52x1c,_0x7e52x1d){_0x7e52x1c[_0x8354[40]]=_0x7e52x19[_0x8354[40]][_0x7e52x1d][_0x8354[40]];_0x7e52x19[_0x8354[39]][_0x7e52x1d]=_0x7e52x1c});_[_0x8354[41]](_0x7e52x1b,function(_0x7e52x1c,_0x7e52x1d){var _0x7e52x1e=_[_0x8354[42]](_0x7e52x19[_0x8354[39]],{"\x71\x75\x65\x73\x74\x69\x6F\x6E\x5F\x69\x64":parseInt(_0x7e52x1c[_0x8354[37]])});var _0x7e52x1f=_0x8354[43];var _0x7e52x20=[];var _0x7e52x21=[];_[_0x8354[41]](_0x7e52x1e,function(_0x7e52x22,_0x7e52x23){_0x7e52x1f=_0x7e52x22[_0x8354[44]];_0x7e52x20[_0x7e52x23]=_0x7e52x22[_0x8354[45]];_0x7e52x21[_0x7e52x23]=_0x7e52x22[_0x8354[40]]});_0x7e52x1b[_0x7e52x1d][_0x8354[44]]=_0x7e52x1f;_0x7e52x1b[_0x7e52x1d][_0x8354[45]]=_0x7e52x20;_0x7e52x1b[_0x7e52x1d][_0x8354[46]]=_0x7e52x21});return _0x7e52xb[_0x8354[12]](201)[_0x8354[11]](_0x7e52x1b)})[_0x8354[19]](function(_0x7e52xc){console[_0x8354[29]](_0x7e52xc);return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[56]]=function(_0x7e52x15,_0x7e52xb){return JscriptyProject[_0x8354[56]](_0x7e52x15[_0x8354[63]])[_0x8354[15]](function(_0x7e52x18){return _0x7e52xb[_0x8354[12]](201)[_0x8354[11]](_0x7e52x18)})[_0x8354[19]](sequelize.UniqueConstraintError,function(_0x7e52xc){if(_0x7e52xc[_0x8354[58]][_0x8354[57]]){_0x7e52xc[_0x8354[59]]=_0x8354[60];_0x7e52xc[_0x8354[61]]=_0x8354[62]};return handleError(_0x7e52xb,_0x7e52xc)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[64]]=function(_0x7e52x15,_0x7e52xb){ReportJscriptySession[_0x8354[56]](_0x7e52x15[_0x8354[63]])[_0x8354[15]](function(_0x7e52x27){return _0x7e52xb[_0x8354[12]](201)[_0x8354[11]](_0x7e52x27)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[65]]=function(_0x7e52x15,_0x7e52xb){ReportJscriptyQuestion[_0x8354[17]]({where:{sessionId:_0x7e52x15[_0x8354[26]][_0x8354[33]]}})[_0x8354[15]](function(){console[_0x8354[29]](_0x8354[66],_0x7e52x15[_0x8354[63]]);var _0x7e52x29=[];_0x7e52x15[_0x8354[63]][_0x8354[41]](function(_0x7e52x2a){_0x7e52x29[_0x8354[53]](ReportJscriptyQuestion[_0x8354[56]](_0x7e52x2a,{include:[{model:ReportJscriptyInput}]}))});return Promise[_0x8354[67]](_0x7e52x29)})[_0x8354[15]](function(_0x7e52x28){return _0x7e52xb[_0x8354[12]](201)[_0x8354[11]](_0x7e52x28)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[68]]=function(_0x7e52x15,_0x7e52xb){if(_0x7e52x15[_0x8354[63]][_0x8354[25]]){delete _0x7e52x15[_0x8354[63]][_0x8354[25]]};JscriptyProject[_0x8354[27]](_0x7e52x15[_0x8354[26]][_0x8354[25]])[_0x8354[15]](function(_0x7e52x18){if(!_0x7e52x18){return _0x7e52xb[_0x8354[24]](404)};var _0x7e52x13=_[_0x8354[69]](_0x7e52x18,_0x7e52x15[_0x8354[63]]);_0x7e52x13[_0x8354[70]]()[_0x8354[15]](function(){return _0x7e52xb[_0x8354[12]](200)[_0x8354[11]](_0x7e52x18)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[71]]=function(_0x7e52x15,_0x7e52xb){ReportJscriptySession[_0x8354[68]](_0x7e52x15[_0x8354[63]],{where:{session_id:_0x7e52x15[_0x8354[26]][_0x8354[33]]}})[_0x8354[15]](function(_0x7e52x27){return _0x7e52xb[_0x8354[12]](200)[_0x8354[11]](_0x7e52x27)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[17]]=function(_0x7e52x15,_0x7e52xb){JscriptyProject[_0x8354[72]]({where:{id:_0x7e52x15[_0x8354[26]][_0x8354[25]]}})[_0x8354[15]](function(_0x7e52x18){if(!_0x7e52x18){return _0x7e52xb[_0x8354[24]](404)};_0x7e52x18[_0x8354[17]]()[_0x8354[15]](function(){return _0x7e52xb[_0x8354[24]](204)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[73]]=function(_0x7e52x15,_0x7e52xb){JscriptyProject[_0x8354[17]]({where:{id:_0x7e52x15[_0x8354[20]][_0x8354[74]]},individualHooks:true})[_0x8354[15]](function(){return _0x7e52xb[_0x8354[24]](204)})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})};exports[_0x8354[75]]=function(_0x7e52x15,_0x7e52xb,_0x7e52x16){JscriptyProject[_0x8354[27]](_0x7e52x15[_0x8354[26]][_0x8354[25]])[_0x8354[15]](function(_0x7e52x18){if(!_0x7e52x18){return _0x7e52xb[_0x8354[24]](404)};console[_0x8354[29]](_0x7e52x15[_0x8354[20]][_0x8354[76]]);_0x7e52xb[_0x8354[80]]({"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x44\x69\x73\x70\x6F\x73\x69\x74\x69\x6F\x6E":_0x8354[77]+_0x7e52x15[_0x8354[20]][_0x8354[76]]+_0x8354[78],"\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x54\x79\x70\x65":_0x8354[79]});return _0x7e52xb[_0x8354[11]](_0x7e52x18[_0x8354[81]])})[_0x8354[19]](function(_0x7e52xc){return handleError(_0x7e52xb,_0x7e52xc)})}