Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / jscriptyProject / jscriptyProject.controller.js
index 6e55c01..3cf8bf0 100644 (file)
@@ -1 +1 @@
-const a378_0x4b19=['role','attributes','JscriptyProject','sort','setHeader','isEmpty','name','json','startTime','options','rawAttributes','count','userProfileId','order','keys','JscriptySessionReport','then','writeFileSync','end','Unable\x20to\x20retrieve\x20the\x20current\x20user','../../components/parsers/qs','merge','parse','length','sequelize','toString','apply','question','create','status','like','filter','findOne','omit','offset','key','include','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','updatedAt','questionId','getAnswers','where','indexOf','destroy','undefined','JscriptyAnswerReport','fields','clone','intersection','autoAssociation','map','VIRTUAL','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','params','findAll','get','YYYY-MM-DD\x20HH:mm:ss','format','UserProfileResource','filters','fromCharCode','replace','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','error','../../config/logger','show','lodash','Content-type','type','limit','api','stack','answer','includeAll','starttime','pick','nolimit','getSessions','Projects','catch','getSummary','model','SessionId','JscriptyQuestionReport','user','to-csv','UserProfileSection','index','fieldName','body','../../mysqldb','rows','push','query','createdAt','attachment;\x20filename=','Content-Range','ProjectId','sendStatus'];(function(_0x50d3e3,_0x4b19d1){const _0x4d0936=function(_0x4a1ee0){while(--_0x4a1ee0){_0x50d3e3['push'](_0x50d3e3['shift']());}};_0x4d0936(++_0x4b19d1);}(a378_0x4b19,0x12f));const a378_0x4d09=function(_0x50d3e3,_0x4b19d1){_0x50d3e3=_0x50d3e3-0x0;let _0x4d0936=a378_0x4b19[_0x50d3e3];return _0x4d0936;};const _0x1f979b=a378_0x4d09;'use strict';const moment=require('moment'),util=require('util'),fs=require('fs'),_=require(_0x1f979b('0x44')),toCsv=require(_0x1f979b('0x57')),qs=require(_0x1f979b('0x14')),logger=require(_0x1f979b('0x42'))(_0x1f979b('0x48')),db=require(_0x1f979b('0x5c'))['db'],{Op}=require(_0x1f979b('0x18'));function respondWithResult(_0x4a1ee0,_0x4075c1){return _0x4075c1=_0x4075c1||0xc8,function(_0x2985e4){const _0x2b7469=a378_0x4d09;if(_0x2985e4)return _0x4a1ee0[_0x2b7469('0x1d')](_0x4075c1)['json'](_0x2985e4);};}function respondWithFilteredResult(_0x1afe64,_0x1431e1){return function(_0x360690){const _0x15e154=a378_0x4d09;if(_0x360690){const _0x537d33=_0x360690[_0x15e154('0xb')],_0x3aeff3=_0x1431e1[_0x15e154('0x22')];let _0x42d2c1=_0x1431e1[_0x15e154('0x22')]+_0x1431e1[_0x15e154('0x47')],_0x15fe81;return _0x42d2c1>=_0x537d33?(_0x42d2c1=_0x537d33,_0x15fe81=0xc8):_0x15fe81=0xce,_0x1afe64['status'](_0x15fe81),_0x1afe64['set'](_0x15e154('0x62'),_0x3aeff3+'-'+_0x42d2c1+'/'+_0x537d33)[_0x15e154('0x7')](_0x360690);}return null;};}function saveUpdates(_0x1a50e0){return function(_0x315bab){const _0x51966c=a378_0x4d09;if(_0x315bab)return _0x315bab['update'](_0x1a50e0)[_0x51966c('0x10')](function(_0x1a9c74){return _0x1a9c74;});return null;};}function removeEntity(_0x50c283){return function(_0x5b09be){const _0x3c3d73=a378_0x4d09;if(_0x5b09be)return _0x5b09be[_0x3c3d73('0x2c')]()[_0x3c3d73('0x10')](function(){const _0x432e0a=_0x3c3d73,_0x3e6ca0=_0x5b09be[_0x432e0a('0x39')]({'plain':!![]}),_0x124ff1=_0x432e0a('0x50');return db[_0x432e0a('0x3c')][_0x432e0a('0x2c')]({'where':{'type':_0x124ff1,'resourceId':_0x3e6ca0['id']}})['then'](function(){return _0x5b09be;});})[_0x3c3d73('0x10')](function(){const _0x27700a=_0x3c3d73;_0x50c283[_0x27700a('0x1d')](0xcc)[_0x27700a('0x12')]();});};}function handleEntityNotFound(_0x4f64e3){return function(_0x1216ef){const _0x8fb6f6=a378_0x4d09;return!_0x1216ef&&_0x4f64e3[_0x8fb6f6('0x64')](0x194),_0x1216ef;};}function handleError(_0x29eb95,_0x3166e4){return _0x3166e4=_0x3166e4||0x1f4,function(_0x49dd17){const _0x506255=a378_0x4d09;logger[_0x506255('0x41')](_0x49dd17[_0x506255('0x49')]),_0x49dd17[_0x506255('0x6')]&&delete _0x49dd17[_0x506255('0x6')],_0x29eb95[_0x506255('0x1d')](_0x3166e4)['send'](_0x49dd17);};}exports[_0x1f979b('0x59')]=function(_0x3deb1b,_0x321274){const _0x4b4a4f=_0x1f979b;let _0x7652b7={};const _0x196bea={},_0x5352f2={'count':0x0,'rows':[]},_0x524a6b=_[_0x4b4a4f('0x33')](db[_0x4b4a4f('0x2')][_0x4b4a4f('0xa')],function(_0xc230f2){const _0x1d5646=_0x4b4a4f;return{'name':_0xc230f2[_0x1d5646('0x5a')],'type':_0xc230f2[_0x1d5646('0x46')][_0x1d5646('0x23')]};});_0x196bea['model']=_[_0x4b4a4f('0x33')](_0x524a6b,_0x4b4a4f('0x6')),_0x196bea[_0x4b4a4f('0x5f')]=_[_0x4b4a4f('0xe')](_0x3deb1b[_0x4b4a4f('0x5f')]),_0x196bea['filters']=_[_0x4b4a4f('0x31')](_0x196bea[_0x4b4a4f('0x53')],_0x196bea[_0x4b4a4f('0x5f')]),_0x7652b7[_0x4b4a4f('0x1')]=_[_0x4b4a4f('0x31')](_0x196bea[_0x4b4a4f('0x53')],qs[_0x4b4a4f('0x2f')](_0x3deb1b['query'][_0x4b4a4f('0x2f')])),_0x7652b7[_0x4b4a4f('0x1')]=_0x7652b7[_0x4b4a4f('0x1')][_0x4b4a4f('0x17')]?_0x7652b7[_0x4b4a4f('0x1')]:_0x196bea[_0x4b4a4f('0x53')];typeof _0x3deb1b['query'][_0x4b4a4f('0x4e')]==='undefined'&&(_0x7652b7[_0x4b4a4f('0x47')]=qs[_0x4b4a4f('0x47')](_0x3deb1b[_0x4b4a4f('0x5f')][_0x4b4a4f('0x47')]),_0x7652b7['offset']=qs[_0x4b4a4f('0x22')](_0x3deb1b[_0x4b4a4f('0x5f')][_0x4b4a4f('0x22')]));_0x7652b7[_0x4b4a4f('0xd')]=qs[_0x4b4a4f('0x3')](_0x3deb1b['query']['sort']),_0x7652b7[_0x4b4a4f('0x2a')]=qs['filters'](_[_0x4b4a4f('0x4d')](_0x3deb1b[_0x4b4a4f('0x5f')],_0x196bea[_0x4b4a4f('0x3d')]),_0x524a6b);_0x3deb1b[_0x4b4a4f('0x5f')][_0x4b4a4f('0x1f')]&&(_0x7652b7[_0x4b4a4f('0x2a')]=_[_0x4b4a4f('0x15')](_0x7652b7[_0x4b4a4f('0x2a')],{[Op['or']]:_[_0x4b4a4f('0x33')](_0x524a6b,function(_0x501ed9){const _0x1b9a93=_0x4b4a4f;if(_0x501ed9[_0x1b9a93('0x46')]!==_0x1b9a93('0x34')){const _0x5ab4cc={};return _0x5ab4cc[_0x501ed9[_0x1b9a93('0x6')]]={[Op['like']]:'%'+_0x3deb1b[_0x1b9a93('0x5f')][_0x1b9a93('0x1f')]+'%'},_0x5ab4cc;}})}));_0x7652b7=_[_0x4b4a4f('0x15')]({},_0x7652b7,_0x3deb1b['options']);const _0x21c99b={'where':_0x7652b7[_0x4b4a4f('0x2a')]};return db[_0x4b4a4f('0x2')]['count'](_0x21c99b)[_0x4b4a4f('0x10')](function(_0x3b3bcc){const _0x1dd0b9=_0x4b4a4f;return _0x5352f2[_0x1dd0b9('0xb')]=_0x3b3bcc,_0x3deb1b[_0x1dd0b9('0x5f')][_0x1dd0b9('0x4b')]&&(_0x7652b7[_0x1dd0b9('0x24')]=[{'all':!![]}]),db['JscriptyProject']['findAll'](_0x7652b7);})[_0x4b4a4f('0x10')](function(_0x4e7c8a){const _0x3c8c32=_0x4b4a4f;return _0x5352f2[_0x3c8c32('0x5d')]=_0x4e7c8a,_0x5352f2;})[_0x4b4a4f('0x10')](respondWithFilteredResult(_0x321274,_0x7652b7))[_0x4b4a4f('0x51')](handleError(_0x321274,null));},exports[_0x1f979b('0x43')]=function(_0x263b94,_0x35a700){const _0x4f1792=_0x1f979b;let _0x5319f3={'raw':![],'where':{'id':_0x263b94[_0x4f1792('0x37')]['id']}};const _0x11673c={};return _0x11673c[_0x4f1792('0x53')]=_[_0x4f1792('0xe')](db['JscriptyProject'][_0x4f1792('0xa')]),_0x11673c[_0x4f1792('0x5f')]=_[_0x4f1792('0xe')](_0x263b94['query']),_0x11673c[_0x4f1792('0x3d')]=_[_0x4f1792('0x31')](_0x11673c[_0x4f1792('0x53')],_0x11673c[_0x4f1792('0x5f')]),_0x5319f3['attributes']=_[_0x4f1792('0x31')](_0x11673c[_0x4f1792('0x53')],qs['fields'](_0x263b94[_0x4f1792('0x5f')][_0x4f1792('0x2f')])),_0x5319f3[_0x4f1792('0x1')]=_0x5319f3[_0x4f1792('0x1')]['length']?_0x5319f3[_0x4f1792('0x1')]:_0x11673c[_0x4f1792('0x53')],_0x263b94['query']['includeAll']&&(_0x5319f3[_0x4f1792('0x24')]=[{'all':!![]}]),_0x5319f3=_[_0x4f1792('0x15')]({},_0x5319f3,_0x263b94[_0x4f1792('0x9')]),db[_0x4f1792('0x2')][_0x4f1792('0x20')](_0x5319f3)['then'](handleEntityNotFound(_0x35a700,null))[_0x4f1792('0x10')](respondWithResult(_0x35a700,null))[_0x4f1792('0x51')](handleError(_0x35a700,null));},exports[_0x1f979b('0x1c')]=function(_0x5be708,_0x25b850){const _0x153d9e=_0x1f979b;return db[_0x153d9e('0x2')][_0x153d9e('0x1c')](_0x5be708[_0x153d9e('0x5b')],{})[_0x153d9e('0x10')](function(_0x5865c9){const _0x494c4e=_0x153d9e,_0x352297=_0x5be708[_0x494c4e('0x56')][_0x494c4e('0x39')]({'plain':!![]});if(!_0x352297)throw new Error(_0x494c4e('0x13'));if(_0x352297[_0x494c4e('0x0')]===_0x494c4e('0x56')){const _0x38acc7=_0x5865c9[_0x494c4e('0x39')]({'plain':!![]}),_0x24ab73='Projects';return db[_0x494c4e('0x58')][_0x494c4e('0x20')]({'where':{'name':_0x24ab73,'userProfileId':_0x352297[_0x494c4e('0xc')]},'raw':!![]})[_0x494c4e('0x10')](function(_0x159f01){const _0x432485=_0x494c4e;return _0x159f01&&_0x159f01[_0x432485('0x32')]===0x0?db[_0x432485('0x3c')][_0x432485('0x1c')]({'name':_0x38acc7[_0x432485('0x6')],'resourceId':_0x38acc7['id'],'type':_0x159f01[_0x432485('0x6')],'sectionId':_0x159f01['id']},{})['then'](function(){return _0x5865c9;}):_0x5865c9;})[_0x494c4e('0x51')](function(_0x1360cc){const _0x26a2ac=_0x494c4e;logger[_0x26a2ac('0x41')](_0x26a2ac('0x40'),_0x1360cc);throw _0x1360cc;});}return _0x5865c9;})[_0x153d9e('0x10')](respondWithResult(_0x25b850,0xc9))[_0x153d9e('0x51')](handleError(_0x25b850,null));},exports[_0x1f979b('0x30')]=function(_0x2e8f81,_0x333531){const _0x3ff8df=_0x1f979b;let _0x468931={'where':{'id':_0x2e8f81[_0x3ff8df('0x37')]['id']}};const _0x294e3e={};return _0x294e3e[_0x3ff8df('0x53')]=_[_0x3ff8df('0xe')](db[_0x3ff8df('0x2')]['rawAttributes']),_0x468931['attributes']=_[_0x3ff8df('0x31')](_0x294e3e[_0x3ff8df('0x53')],qs[_0x3ff8df('0x2f')](_0x2e8f81[_0x3ff8df('0x5f')][_0x3ff8df('0x2f')])),_0x468931['attributes']=_0x468931[_0x3ff8df('0x1')][_0x3ff8df('0x17')]?_0x468931['attributes']:_0x294e3e['model'],_0x2e8f81['query'][_0x3ff8df('0x4b')]&&(_0x468931[_0x3ff8df('0x24')]=[{'all':!![]}]),_0x468931=_[_0x3ff8df('0x15')]({},_0x468931,_0x2e8f81['options']),db['JscriptyProject']['findOne'](_0x468931)[_0x3ff8df('0x10')](handleEntityNotFound(_0x333531,null))[_0x3ff8df('0x10')](function(_0x4aaa6b){const _0x3f6ca8=_0x3ff8df;if(_0x4aaa6b){let _0x42ed41=_0x4aaa6b['get']({'plain':!![]});return _0x42ed41=qs['omit'](_0x42ed41,['id',_0x3f6ca8('0x60'),_0x3f6ca8('0x27')]),_0x2e8f81[_0x3f6ca8('0x5b')]=_[_0x3f6ca8('0x21')](_0x2e8f81[_0x3f6ca8('0x5b')],['id',_0x3f6ca8('0x60'),_0x3f6ca8('0x27')]),db[_0x3f6ca8('0x2')]['create'](_['merge'](_0x42ed41,_0x2e8f81[_0x3f6ca8('0x5b')]),{'include':_0x2e8f81[_0x3f6ca8('0x5f')]['includeAll']?[{'all':!![]}]:undefined})[_0x3f6ca8('0x10')](function(_0x3f2ac4){const _0x30bfff=_0x3f6ca8,_0x1573e2=_0x2e8f81[_0x30bfff('0x56')][_0x30bfff('0x39')]({'plain':!![]});if(!_0x1573e2)throw new Error(_0x30bfff('0x13'));if(_0x1573e2[_0x30bfff('0x0')]===_0x30bfff('0x56')){const _0x538268=_0x3f2ac4[_0x30bfff('0x39')]({'plain':!![]}),_0x246ff1=_0x30bfff('0x50');return db[_0x30bfff('0x58')]['findOne']({'where':{'name':_0x246ff1,'userProfileId':_0x1573e2[_0x30bfff('0xc')]},'raw':!![]})['then'](function(_0x143722){const _0x5790d8=_0x30bfff;return _0x143722&&_0x143722['autoAssociation']===0x0?db['UserProfileResource'][_0x5790d8('0x1c')]({'name':_0x538268[_0x5790d8('0x6')],'resourceId':_0x538268['id'],'type':_0x143722[_0x5790d8('0x6')],'sectionId':_0x143722['id']},{})[_0x5790d8('0x10')](function(){return _0x3f2ac4;}):_0x3f2ac4;})['catch'](function(_0x1519b6){const _0x44d427=_0x30bfff;logger[_0x44d427('0x41')](_0x44d427('0x40'),_0x1519b6);throw _0x1519b6;});}return _0x3f2ac4;});}})['then'](respondWithResult(_0x333531,0xc9))[_0x3ff8df('0x51')](handleError(_0x333531,null));},exports['update']=function(_0x4e8e21,_0x3432a8){const _0x1a80d1=_0x1f979b;return _0x4e8e21['body']['id']&&delete _0x4e8e21[_0x1a80d1('0x5b')]['id'],db[_0x1a80d1('0x2')][_0x1a80d1('0x20')]({'where':{'id':_0x4e8e21[_0x1a80d1('0x37')]['id']}})[_0x1a80d1('0x10')](handleEntityNotFound(_0x3432a8,null))[_0x1a80d1('0x10')](saveUpdates(_0x4e8e21[_0x1a80d1('0x5b')],null))[_0x1a80d1('0x10')](respondWithResult(_0x3432a8,null))[_0x1a80d1('0x51')](handleError(_0x3432a8,null));},exports['destroy']=function(_0x1a23c5,_0x4d9a4f){const _0x34651b=_0x1f979b;return db[_0x34651b('0x2')]['findOne']({'where':{'id':_0x1a23c5['params']['id']}})['then'](handleEntityNotFound(_0x4d9a4f,null))[_0x34651b('0x10')](removeEntity(_0x4d9a4f,null))[_0x34651b('0x51')](handleError(_0x4d9a4f,null));},exports[_0x1f979b('0x4f')]=function(_0x1ebe8f,_0xa784f8){const _0x2d9dff=_0x1f979b;let _0x18c645={'raw':!![],'where':{}};const _0x588b39={},_0x50caf2={'count':0x0,'rows':[]};return db[_0x2d9dff('0x2')][_0x2d9dff('0x20')]({'where':{'id':_0x1ebe8f[_0x2d9dff('0x37')]['id']}})[_0x2d9dff('0x10')](handleEntityNotFound(_0xa784f8,null))[_0x2d9dff('0x10')](function(_0x26e9e6){const _0x2dc764=_0x2d9dff;if(_0x26e9e6)return _0x588b39[_0x2dc764('0x53')]=_['keys'](db[_0x2dc764('0xf')][_0x2dc764('0xa')]),_0x588b39[_0x2dc764('0x5f')]=_[_0x2dc764('0xe')](_0x1ebe8f['query']),_0x588b39['filters']=_[_0x2dc764('0x31')](_0x588b39['model'],_0x588b39[_0x2dc764('0x5f')]),_0x18c645['attributes']=_[_0x2dc764('0x31')](_0x588b39[_0x2dc764('0x53')],qs[_0x2dc764('0x2f')](_0x1ebe8f['query'][_0x2dc764('0x2f')])),_0x18c645[_0x2dc764('0x1')]=_0x18c645[_0x2dc764('0x1')][_0x2dc764('0x17')]?_0x18c645[_0x2dc764('0x1')]:_0x588b39['model'],typeof _0x1ebe8f[_0x2dc764('0x5f')][_0x2dc764('0x4e')]===_0x2dc764('0x2d')&&(_0x18c645[_0x2dc764('0x47')]=qs['limit'](_0x1ebe8f['query']['limit']),_0x18c645[_0x2dc764('0x22')]=qs['offset'](_0x1ebe8f[_0x2dc764('0x5f')]['offset'])),_0x18c645[_0x2dc764('0xd')]=qs['sort'](_0x1ebe8f[_0x2dc764('0x5f')][_0x2dc764('0x3')]),_0x18c645[_0x2dc764('0x2a')]=qs[_0x2dc764('0x3d')](_[_0x2dc764('0x4d')](_0x1ebe8f[_0x2dc764('0x5f')],_0x588b39[_0x2dc764('0x3d')])),_0x18c645['where']['ProjectId']=_0x26e9e6['id'],_0x1ebe8f[_0x2dc764('0x5f')][_0x2dc764('0x1f')]&&(_0x18c645[_0x2dc764('0x2a')]=_[_0x2dc764('0x15')](_0x18c645[_0x2dc764('0x2a')],{[Op['or']]:_[_0x2dc764('0x33')](_0x18c645['attributes'],function(_0xbeb0b3){const _0x45022b=_0x2dc764,_0x54ef86={};return _0x54ef86[_0xbeb0b3]={[Op[_0x45022b('0x1e')]]:'%'+_0x1ebe8f['query']['filter']+'%'},_0x54ef86;})})),_0x18c645=_['merge']({},_0x18c645,_0x1ebe8f[_0x2dc764('0x9')]),db[_0x2dc764('0xf')]['count']({'where':_0x18c645[_0x2dc764('0x2a')]})['then'](function(_0x33f384){const _0x2d1dd7=_0x2dc764;return _0x50caf2['count']=_0x33f384,_0x1ebe8f['query']['includeAll']&&(_0x18c645[_0x2d1dd7('0x24')]=[{'all':!![]}]),db[_0x2d1dd7('0xf')][_0x2d1dd7('0x38')](_0x18c645);})[_0x2dc764('0x10')](function(_0x500319){const _0x1dc152=_0x2dc764;return _0x50caf2[_0x1dc152('0x5d')]=_0x500319,_0x50caf2;});})['then'](respondWithFilteredResult(_0xa784f8,_0x18c645))['catch'](handleError(_0xa784f8,null));},exports[_0x1f979b('0x29')]=function(_0x25f5c4,_0x5c0f06){const _0x3cefa6=_0x1f979b;let _0x5d11c8={'raw':!![],'where':{}};const _0x5bf97b={},_0x2e85f7={'count':0x0,'rows':[]};return db[_0x3cefa6('0x2')]['findOne']({'where':{'id':_0x25f5c4[_0x3cefa6('0x37')]['id']}})[_0x3cefa6('0x10')](handleEntityNotFound(_0x5c0f06,null))[_0x3cefa6('0x10')](function(_0x3c6646){const _0x5445ea=_0x3cefa6;if(_0x3c6646)return _0x5bf97b[_0x5445ea('0x53')]=_[_0x5445ea('0xe')](db[_0x5445ea('0x2e')]['rawAttributes']),_0x5bf97b[_0x5445ea('0x5f')]=_[_0x5445ea('0xe')](_0x25f5c4['query']),_0x5bf97b[_0x5445ea('0x3d')]=_['intersection'](_0x5bf97b[_0x5445ea('0x53')],_0x5bf97b[_0x5445ea('0x5f')]),_0x5d11c8[_0x5445ea('0x1')]=_[_0x5445ea('0x31')](_0x5bf97b[_0x5445ea('0x53')],qs[_0x5445ea('0x2f')](_0x25f5c4[_0x5445ea('0x5f')][_0x5445ea('0x2f')])),_0x5d11c8['attributes']=_0x5d11c8[_0x5445ea('0x1')][_0x5445ea('0x17')]?_0x5d11c8[_0x5445ea('0x1')]:_0x5bf97b[_0x5445ea('0x53')],typeof _0x25f5c4[_0x5445ea('0x5f')][_0x5445ea('0x4e')]==='undefined'&&(_0x5d11c8[_0x5445ea('0x47')]=qs[_0x5445ea('0x47')](_0x25f5c4['query']['limit']),_0x5d11c8['offset']=qs['offset'](_0x25f5c4[_0x5445ea('0x5f')][_0x5445ea('0x22')])),_0x5d11c8['order']=qs[_0x5445ea('0x3')](_0x25f5c4['query'][_0x5445ea('0x3')]),_0x5d11c8['where']=qs[_0x5445ea('0x3d')](_['pick'](_0x25f5c4['query'],_0x5bf97b[_0x5445ea('0x3d')])),_0x5d11c8['where'][_0x5445ea('0x63')]=_0x3c6646['id'],_0x25f5c4[_0x5445ea('0x5f')][_0x5445ea('0x1f')]&&(_0x5d11c8[_0x5445ea('0x2a')]=_[_0x5445ea('0x15')](_0x5d11c8[_0x5445ea('0x2a')],{[Op['or']]:_[_0x5445ea('0x33')](_0x5d11c8[_0x5445ea('0x1')],function(_0x24d5cd){const _0x25804e=_0x5445ea,_0x3d4562={};return _0x3d4562[_0x24d5cd]={[Op['like']]:'%'+_0x25f5c4[_0x25804e('0x5f')][_0x25804e('0x1f')]+'%'},_0x3d4562;})})),_0x5d11c8=_[_0x5445ea('0x15')]({},_0x5d11c8,_0x25f5c4[_0x5445ea('0x9')]),db[_0x5445ea('0x2e')][_0x5445ea('0xb')]({'where':_0x5d11c8[_0x5445ea('0x2a')]})[_0x5445ea('0x10')](function(_0x539db8){const _0x4ad3c7=_0x5445ea;return _0x2e85f7[_0x4ad3c7('0xb')]=_0x539db8,_0x25f5c4['query'][_0x4ad3c7('0x4b')]&&(_0x5d11c8[_0x4ad3c7('0x24')]=[{'all':!![]}]),db[_0x4ad3c7('0x2e')][_0x4ad3c7('0x38')](_0x5d11c8);})[_0x5445ea('0x10')](function(_0x323450){const _0x1a0653=_0x5445ea;return _0x2e85f7[_0x1a0653('0x5d')]=_0x323450,_0x2e85f7;});})[_0x3cefa6('0x10')](respondWithFilteredResult(_0x5c0f06,_0x5d11c8))[_0x3cefa6('0x51')](handleError(_0x5c0f06,null));};function char(_0x1b5127){const _0x1d49f9=_0x1f979b;return'number'===typeof _0x1b5127?String[_0x1d49f9('0x3e')][_0x1d49f9('0x1a')](null,arguments):_0x1b5127;}function needsEncapsulation(_0x12979c){const _0x275ebd=_0x1f979b;return!!_0x12979c&&(_0x12979c[_0x275ebd('0x19')]()[_0x275ebd('0x2b')](char(0xd))>=0x0||_0x12979c['toString']()[_0x275ebd('0x2b')](char(0xa))>=0x0||_0x12979c[_0x275ebd('0x19')]()[_0x275ebd('0x2b')](char(0x2c))>=0x0||_0x12979c[_0x275ebd('0x19')]()[_0x275ebd('0x2b')](char(0x22))>=0x0);}function encapsulate(_0x356adc){const _0x1216dd=_0x1f979b,_0x1afb52=char(0x22),_0x5431a0='\x5c'+char(0x22),_0x4a76a9=_0x356adc[_0x1216dd('0x19')]()[_0x1216dd('0x3f')](new RegExp(_0x1afb52,'g'),_0x5431a0);return _0x1afb52+_0x4a76a9+_0x1afb52;}exports[_0x1f979b('0x52')]=function(_0x89378d,_0x1d6bf2){const _0x5165c0=_0x1f979b;let _0x581233,_0x4c5ce4;const _0x377f72={'where':{'ProjectId':_0x89378d[_0x5165c0('0x37')]['id']}};return _0x89378d[_0x5165c0('0x5f')][_0x5165c0('0x8')]&&(_0x377f72[_0x5165c0('0x2a')][_0x5165c0('0x4c')]=JSON[_0x5165c0('0x16')](_0x89378d[_0x5165c0('0x5f')][_0x5165c0('0x8')])),db[_0x5165c0('0xf')]['findAll'](_0x377f72)[_0x5165c0('0x10')](handleEntityNotFound(_0x1d6bf2,null))[_0x5165c0('0x10')](function(_0x2d871e){const _0x303fcd=_0x5165c0;if(_0x2d871e)return _0x581233=_0x2d871e,db[_0x303fcd('0x55')][_0x303fcd('0x38')]({'where':{'SessionId':{[Op['in']]:_[_0x303fcd('0x33')](_0x581233,'id')},'ProjectId':_0x89378d[_0x303fcd('0x37')]['id']},'order':'-createdAt'});})[_0x5165c0('0x10')](handleEntityNotFound(_0x1d6bf2,null))['then'](function(_0x3a651d){const _0x44f65d=_0x5165c0;if(_0x3a651d){_0x4c5ce4=_0x3a651d;const _0x183c8c={};for(let _0x32e651=0x0,_0x21ec13=_0x4c5ce4[_0x44f65d('0x17')];_0x32e651<_0x21ec13;_0x32e651++){typeof _0x183c8c[_0x4c5ce4[_0x32e651][_0x44f65d('0x28')]]==='undefined'&&(_0x183c8c[_0x4c5ce4[_0x32e651]['questionId']]=needsEncapsulation(_0x4c5ce4[_0x32e651][_0x44f65d('0x1b')])?encapsulate(_0x4c5ce4[_0x32e651][_0x44f65d('0x1b')]):_0x4c5ce4[_0x32e651]['question']);}const _0x425f4a=[];let _0x17c791={};for(let _0x33ff32=0x0,_0x3940a4=_0x581233[_0x44f65d('0x17')];_0x33ff32<_0x3940a4;_0x33ff32++){_0x17c791={'ProjectId':_0x89378d['params']['id'],'SessionId':_0x581233[_0x33ff32]['id'],'StartTime':moment(_0x581233[_0x33ff32]['starttime'])[_0x44f65d('0x3b')](_0x44f65d('0x3a'))};for(let _0x3674c8=0x0,_0x3ec49a=_0x4c5ce4[_0x44f65d('0x17')];_0x3674c8<_0x3ec49a;_0x3674c8++){_0x4c5ce4[_0x3674c8][_0x44f65d('0x54')]===_0x581233[_0x33ff32]['id']&&typeof _0x183c8c[_0x4c5ce4[_0x3674c8]['questionId']]!==_0x44f65d('0x2d')&&(_0x17c791[_0x183c8c[_0x4c5ce4[_0x3674c8][_0x44f65d('0x28')]]]=_0x4c5ce4[_0x3674c8][_0x44f65d('0x4a')]);}for(const _0x1a3700 in _0x183c8c){typeof _0x17c791[_0x183c8c[_0x1a3700]]===_0x44f65d('0x2d')&&(_0x17c791[_0x183c8c[_0x1a3700]]=null);}_0x425f4a[_0x44f65d('0x5e')](_0x17c791);}return _0x425f4a;}})[_0x5165c0('0x10')](function(_0x4b2810){const _0x3623d5=_0x5165c0;if(!_[_0x3623d5('0x5')](_0x4b2810)){const _0x253614=toCsv(_0x4b2810),_0x1bd946=Date['now']();return fs[_0x3623d5('0x11')](util[_0x3623d5('0x3b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x89378d[_0x3623d5('0x37')]['id'],_0x1bd946),_0x253614),_0x1d6bf2['setHeader'](_0x3623d5('0x35'),_0x3623d5('0x61')+util[_0x3623d5('0x3b')](_0x3623d5('0x36'),_0x89378d[_0x3623d5('0x37')]['id'],_0x1bd946)),_0x1d6bf2[_0x3623d5('0x4')](_0x3623d5('0x45'),_0x3623d5('0x25')),_0x1d6bf2['download'](util[_0x3623d5('0x3b')](_0x3623d5('0x26'),_0x89378d[_0x3623d5('0x37')]['id'],_0x1bd946));}else return _0x1d6bf2['sendStatus'](0xcc);})[_0x5165c0('0x51')](handleError(_0x1d6bf2,null));};
\ No newline at end of file
+const a378_0x380e=['lodash','download','omit','fields','question','name','count','writeFileSync','map','Jscripty_Project_%d_Summary_%s.csv','Unable\x20to\x20retrieve\x20the\x20current\x20user','startTime','sequelize','toString','attachment;\x20filename=','rows','sort','create','text/csv','includeAll','userProfileId','keys','UserProfileResource','UserProfileSection','type','end','index','role','findOne','pick','stack','JscriptyQuestionReport','intersection','../../components/parsers/qs','offset','options','ProjectId','-createdAt','Projects','error','replace','moment','get','order','getSessions','rawAttributes','../../config/logger','include','fromCharCode','query','findAll','length','fieldName','format','params','updatedAt','filter','getSummary','JscriptyAnswerReport','where','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','parse','push','attributes','json','JscriptyProject','catch','starttime','util','then','number','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','undefined','destroy','Content-Range','sendStatus','filters','set','user','nolimit','SessionId','body','model','../../mysqldb','limit','indexOf','YYYY-MM-DD\x20HH:mm:ss','merge','isEmpty','Content-disposition','questionId','to-csv','JscriptySessionReport','VIRTUAL','clone','answer','like','status','update'];(function(_0x11333f,_0x380e63){const _0x598873=function(_0x2113ee){while(--_0x2113ee){_0x11333f['push'](_0x11333f['shift']());}};_0x598873(++_0x380e63);}(a378_0x380e,0x1c6));const a378_0x5988=function(_0x11333f,_0x380e63){_0x11333f=_0x11333f-0x0;let _0x598873=a378_0x380e[_0x11333f];return _0x598873;};const _0x2c8c11=a378_0x5988;'use strict';const moment=require(_0x2c8c11('0x57')),util=require(_0x2c8c11('0xf')),fs=require('fs'),_=require(_0x2c8c11('0x2e')),toCsv=require(_0x2c8c11('0x26')),qs=require(_0x2c8c11('0x4f')),logger=require(_0x2c8c11('0x5c'))('api'),db=require(_0x2c8c11('0x1e'))['db'],{Op}=require(_0x2c8c11('0x3a'));function respondWithResult(_0x2113ee,_0x5032a9){return _0x5032a9=_0x5032a9||0xc8,function(_0x3ad22f){const _0x494316=a378_0x5988;if(_0x3ad22f)return _0x2113ee[_0x494316('0x2c')](_0x5032a9)[_0x494316('0xb')](_0x3ad22f);};}function respondWithFilteredResult(_0x2cc91e,_0x59855c){return function(_0x28a650){const _0x4a2557=a378_0x5988;if(_0x28a650){const _0x4da204=_0x28a650[_0x4a2557('0x34')],_0x225e6e=_0x59855c[_0x4a2557('0x50')];let _0x333f0f=_0x59855c[_0x4a2557('0x50')]+_0x59855c[_0x4a2557('0x1f')],_0xf405df;return _0x333f0f>=_0x4da204?(_0x333f0f=_0x4da204,_0xf405df=0xc8):_0xf405df=0xce,_0x2cc91e[_0x4a2557('0x2c')](_0xf405df),_0x2cc91e[_0x4a2557('0x18')](_0x4a2557('0x15'),_0x225e6e+'-'+_0x333f0f+'/'+_0x4da204)[_0x4a2557('0xb')](_0x28a650);}return null;};}function saveUpdates(_0x4063a9){return function(_0x272931){const _0x1f3c12=a378_0x5988;if(_0x272931)return _0x272931['update'](_0x4063a9)[_0x1f3c12('0x10')](function(_0x244511){return _0x244511;});return null;};}function removeEntity(_0xd748a5){return function(_0x49f907){const _0x4e476f=a378_0x5988;if(_0x49f907)return _0x49f907[_0x4e476f('0x14')]()[_0x4e476f('0x10')](function(){const _0x271943=_0x4e476f,_0x282f3e=_0x49f907[_0x271943('0x58')]({'plain':!![]}),_0x53071a=_0x271943('0x54');return db[_0x271943('0x44')]['destroy']({'where':{'type':_0x53071a,'resourceId':_0x282f3e['id']}})[_0x271943('0x10')](function(){return _0x49f907;});})['then'](function(){const _0xd92dba=_0x4e476f;_0xd748a5[_0xd92dba('0x2c')](0xcc)[_0xd92dba('0x47')]();});};}function handleEntityNotFound(_0x46f863){return function(_0x224f3b){const _0x22fb5a=a378_0x5988;return!_0x224f3b&&_0x46f863[_0x22fb5a('0x16')](0x194),_0x224f3b;};}function handleError(_0x3597d5,_0x5a91ad){return _0x5a91ad=_0x5a91ad||0x1f4,function(_0x12fda5){const _0x41b045=a378_0x5988;logger[_0x41b045('0x55')](_0x12fda5[_0x41b045('0x4c')]),_0x12fda5[_0x41b045('0x33')]&&delete _0x12fda5[_0x41b045('0x33')],_0x3597d5['status'](_0x5a91ad)['send'](_0x12fda5);};}exports[_0x2c8c11('0x48')]=function(_0x494153,_0x2f8d07){const _0x418ca7=_0x2c8c11;let _0x555d7a={};const _0x490b36={},_0x522b35={'count':0x0,'rows':[]},_0x194598=_[_0x418ca7('0x36')](db[_0x418ca7('0xc')][_0x418ca7('0x5b')],function(_0x413072){const _0x5c8429=_0x418ca7;return{'name':_0x413072[_0x5c8429('0x62')],'type':_0x413072[_0x5c8429('0x46')]['key']};});_0x490b36[_0x418ca7('0x1d')]=_[_0x418ca7('0x36')](_0x194598,_0x418ca7('0x33')),_0x490b36['query']=_['keys'](_0x494153[_0x418ca7('0x5f')]),_0x490b36[_0x418ca7('0x17')]=_['intersection'](_0x490b36['model'],_0x490b36['query']),_0x555d7a[_0x418ca7('0xa')]=_[_0x418ca7('0x4e')](_0x490b36[_0x418ca7('0x1d')],qs[_0x418ca7('0x31')](_0x494153[_0x418ca7('0x5f')]['fields'])),_0x555d7a[_0x418ca7('0xa')]=_0x555d7a[_0x418ca7('0xa')][_0x418ca7('0x61')]?_0x555d7a['attributes']:_0x490b36['model'];typeof _0x494153[_0x418ca7('0x5f')][_0x418ca7('0x1a')]===_0x418ca7('0x13')&&(_0x555d7a[_0x418ca7('0x1f')]=qs[_0x418ca7('0x1f')](_0x494153[_0x418ca7('0x5f')]['limit']),_0x555d7a[_0x418ca7('0x50')]=qs[_0x418ca7('0x50')](_0x494153['query'][_0x418ca7('0x50')]));_0x555d7a['order']=qs[_0x418ca7('0x3e')](_0x494153[_0x418ca7('0x5f')][_0x418ca7('0x3e')]),_0x555d7a['where']=qs[_0x418ca7('0x17')](_[_0x418ca7('0x4b')](_0x494153['query'],_0x490b36[_0x418ca7('0x17')]),_0x194598);_0x494153[_0x418ca7('0x5f')][_0x418ca7('0x2')]&&(_0x555d7a[_0x418ca7('0x5')]=_['merge'](_0x555d7a[_0x418ca7('0x5')],{[Op['or']]:_[_0x418ca7('0x36')](_0x194598,function(_0x3f6ddd){const _0x16b9f6=_0x418ca7;if(_0x3f6ddd[_0x16b9f6('0x46')]!==_0x16b9f6('0x28')){const _0xb4a87={};return _0xb4a87[_0x3f6ddd[_0x16b9f6('0x33')]]={[Op[_0x16b9f6('0x2b')]]:'%'+_0x494153[_0x16b9f6('0x5f')]['filter']+'%'},_0xb4a87;}})}));_0x555d7a=_[_0x418ca7('0x22')]({},_0x555d7a,_0x494153[_0x418ca7('0x51')]);const _0x1a4510={'where':_0x555d7a[_0x418ca7('0x5')]};return db[_0x418ca7('0xc')][_0x418ca7('0x34')](_0x1a4510)[_0x418ca7('0x10')](function(_0x1193dd){const _0x166f39=_0x418ca7;return _0x522b35[_0x166f39('0x34')]=_0x1193dd,_0x494153['query'][_0x166f39('0x41')]&&(_0x555d7a['include']=[{'all':!![]}]),db['JscriptyProject']['findAll'](_0x555d7a);})['then'](function(_0x48bfa1){const _0x546784=_0x418ca7;return _0x522b35[_0x546784('0x3d')]=_0x48bfa1,_0x522b35;})['then'](respondWithFilteredResult(_0x2f8d07,_0x555d7a))[_0x418ca7('0xd')](handleError(_0x2f8d07,null));},exports['show']=function(_0x2507e1,_0x5896ba){const _0x1f9a3d=_0x2c8c11;let _0x4316c0={'raw':![],'where':{'id':_0x2507e1[_0x1f9a3d('0x0')]['id']}};const _0x88fdd2={};return _0x88fdd2[_0x1f9a3d('0x1d')]=_['keys'](db[_0x1f9a3d('0xc')][_0x1f9a3d('0x5b')]),_0x88fdd2[_0x1f9a3d('0x5f')]=_['keys'](_0x2507e1['query']),_0x88fdd2[_0x1f9a3d('0x17')]=_[_0x1f9a3d('0x4e')](_0x88fdd2[_0x1f9a3d('0x1d')],_0x88fdd2['query']),_0x4316c0[_0x1f9a3d('0xa')]=_[_0x1f9a3d('0x4e')](_0x88fdd2[_0x1f9a3d('0x1d')],qs['fields'](_0x2507e1[_0x1f9a3d('0x5f')][_0x1f9a3d('0x31')])),_0x4316c0['attributes']=_0x4316c0[_0x1f9a3d('0xa')][_0x1f9a3d('0x61')]?_0x4316c0[_0x1f9a3d('0xa')]:_0x88fdd2[_0x1f9a3d('0x1d')],_0x2507e1[_0x1f9a3d('0x5f')][_0x1f9a3d('0x41')]&&(_0x4316c0['include']=[{'all':!![]}]),_0x4316c0=_['merge']({},_0x4316c0,_0x2507e1[_0x1f9a3d('0x51')]),db['JscriptyProject']['findOne'](_0x4316c0)[_0x1f9a3d('0x10')](handleEntityNotFound(_0x5896ba,null))[_0x1f9a3d('0x10')](respondWithResult(_0x5896ba,null))[_0x1f9a3d('0xd')](handleError(_0x5896ba,null));},exports['create']=function(_0x20bb9a,_0x32be51){const _0x9d0b31=_0x2c8c11;return db['JscriptyProject'][_0x9d0b31('0x3f')](_0x20bb9a[_0x9d0b31('0x1c')],{})[_0x9d0b31('0x10')](function(_0x27f197){const _0x1b66e2=_0x9d0b31,_0xe46aa5=_0x20bb9a['user'][_0x1b66e2('0x58')]({'plain':!![]});if(!_0xe46aa5)throw new Error(_0x1b66e2('0x38'));if(_0xe46aa5[_0x1b66e2('0x49')]===_0x1b66e2('0x19')){const _0x38a61b=_0x27f197[_0x1b66e2('0x58')]({'plain':!![]}),_0x4d82cf=_0x1b66e2('0x54');return db[_0x1b66e2('0x45')][_0x1b66e2('0x4a')]({'where':{'name':_0x4d82cf,'userProfileId':_0xe46aa5[_0x1b66e2('0x42')]},'raw':!![]})['then'](function(_0x47e0b9){const _0x4c70f9=_0x1b66e2;return _0x47e0b9&&_0x47e0b9['autoAssociation']===0x0?db[_0x4c70f9('0x44')]['create']({'name':_0x38a61b[_0x4c70f9('0x33')],'resourceId':_0x38a61b['id'],'type':_0x47e0b9[_0x4c70f9('0x33')],'sectionId':_0x47e0b9['id']},{})[_0x4c70f9('0x10')](function(){return _0x27f197;}):_0x27f197;})[_0x1b66e2('0xd')](function(_0x4a4dea){const _0x2402bb=_0x1b66e2;logger[_0x2402bb('0x55')](_0x2402bb('0x12'),_0x4a4dea);throw _0x4a4dea;});}return _0x27f197;})[_0x9d0b31('0x10')](respondWithResult(_0x32be51,0xc9))[_0x9d0b31('0xd')](handleError(_0x32be51,null));},exports[_0x2c8c11('0x29')]=function(_0x3ce62e,_0x3ca66b){const _0x220720=_0x2c8c11;let _0x570f80={'where':{'id':_0x3ce62e['params']['id']}};const _0xe996a1={};return _0xe996a1[_0x220720('0x1d')]=_['keys'](db[_0x220720('0xc')][_0x220720('0x5b')]),_0x570f80['attributes']=_[_0x220720('0x4e')](_0xe996a1[_0x220720('0x1d')],qs[_0x220720('0x31')](_0x3ce62e[_0x220720('0x5f')][_0x220720('0x31')])),_0x570f80[_0x220720('0xa')]=_0x570f80[_0x220720('0xa')][_0x220720('0x61')]?_0x570f80[_0x220720('0xa')]:_0xe996a1['model'],_0x3ce62e[_0x220720('0x5f')][_0x220720('0x41')]&&(_0x570f80[_0x220720('0x5d')]=[{'all':!![]}]),_0x570f80=_[_0x220720('0x22')]({},_0x570f80,_0x3ce62e[_0x220720('0x51')]),db[_0x220720('0xc')][_0x220720('0x4a')](_0x570f80)[_0x220720('0x10')](handleEntityNotFound(_0x3ca66b,null))[_0x220720('0x10')](function(_0x415f4){const _0x5c3a40=_0x220720;if(_0x415f4){let _0x372895=_0x415f4[_0x5c3a40('0x58')]({'plain':!![]});return _0x372895=qs['omit'](_0x372895,['id','createdAt',_0x5c3a40('0x1')]),_0x3ce62e[_0x5c3a40('0x1c')]=_[_0x5c3a40('0x30')](_0x3ce62e['body'],['id','createdAt',_0x5c3a40('0x1')]),db[_0x5c3a40('0xc')][_0x5c3a40('0x3f')](_[_0x5c3a40('0x22')](_0x372895,_0x3ce62e[_0x5c3a40('0x1c')]),{'include':_0x3ce62e[_0x5c3a40('0x5f')][_0x5c3a40('0x41')]?[{'all':!![]}]:undefined})[_0x5c3a40('0x10')](function(_0x13840f){const _0xfcc1b1=_0x5c3a40,_0x24874b=_0x3ce62e['user'][_0xfcc1b1('0x58')]({'plain':!![]});if(!_0x24874b)throw new Error(_0xfcc1b1('0x38'));if(_0x24874b[_0xfcc1b1('0x49')]==='user'){const _0x1aa727=_0x13840f[_0xfcc1b1('0x58')]({'plain':!![]}),_0x475fdc=_0xfcc1b1('0x54');return db[_0xfcc1b1('0x45')][_0xfcc1b1('0x4a')]({'where':{'name':_0x475fdc,'userProfileId':_0x24874b['userProfileId']},'raw':!![]})['then'](function(_0x177d15){const _0x46053e=_0xfcc1b1;return _0x177d15&&_0x177d15['autoAssociation']===0x0?db[_0x46053e('0x44')][_0x46053e('0x3f')]({'name':_0x1aa727[_0x46053e('0x33')],'resourceId':_0x1aa727['id'],'type':_0x177d15[_0x46053e('0x33')],'sectionId':_0x177d15['id']},{})['then'](function(){return _0x13840f;}):_0x13840f;})[_0xfcc1b1('0xd')](function(_0x18b91a){const _0x1b5570=_0xfcc1b1;logger['error'](_0x1b5570('0x12'),_0x18b91a);throw _0x18b91a;});}return _0x13840f;});}})['then'](respondWithResult(_0x3ca66b,0xc9))[_0x220720('0xd')](handleError(_0x3ca66b,null));},exports[_0x2c8c11('0x2d')]=function(_0x48673c,_0x3f1af2){const _0x2bb163=_0x2c8c11;return _0x48673c[_0x2bb163('0x1c')]['id']&&delete _0x48673c[_0x2bb163('0x1c')]['id'],db['JscriptyProject'][_0x2bb163('0x4a')]({'where':{'id':_0x48673c[_0x2bb163('0x0')]['id']}})[_0x2bb163('0x10')](handleEntityNotFound(_0x3f1af2,null))[_0x2bb163('0x10')](saveUpdates(_0x48673c[_0x2bb163('0x1c')],null))[_0x2bb163('0x10')](respondWithResult(_0x3f1af2,null))[_0x2bb163('0xd')](handleError(_0x3f1af2,null));},exports['destroy']=function(_0x548d4b,_0x3b5c6c){const _0x36815a=_0x2c8c11;return db[_0x36815a('0xc')][_0x36815a('0x4a')]({'where':{'id':_0x548d4b[_0x36815a('0x0')]['id']}})[_0x36815a('0x10')](handleEntityNotFound(_0x3b5c6c,null))['then'](removeEntity(_0x3b5c6c,null))['catch'](handleError(_0x3b5c6c,null));},exports[_0x2c8c11('0x5a')]=function(_0x2e10e6,_0x4929f7){const _0x4283a8=_0x2c8c11;let _0x279d04={'raw':!![],'where':{}};const _0x1acd9c={},_0x5f5a2e={'count':0x0,'rows':[]};return db[_0x4283a8('0xc')][_0x4283a8('0x4a')]({'where':{'id':_0x2e10e6[_0x4283a8('0x0')]['id']}})[_0x4283a8('0x10')](handleEntityNotFound(_0x4929f7,null))[_0x4283a8('0x10')](function(_0x1fb46a){const _0xfa142f=_0x4283a8;if(_0x1fb46a)return _0x1acd9c[_0xfa142f('0x1d')]=_['keys'](db[_0xfa142f('0x27')][_0xfa142f('0x5b')]),_0x1acd9c[_0xfa142f('0x5f')]=_[_0xfa142f('0x43')](_0x2e10e6[_0xfa142f('0x5f')]),_0x1acd9c[_0xfa142f('0x17')]=_[_0xfa142f('0x4e')](_0x1acd9c[_0xfa142f('0x1d')],_0x1acd9c[_0xfa142f('0x5f')]),_0x279d04[_0xfa142f('0xa')]=_[_0xfa142f('0x4e')](_0x1acd9c['model'],qs[_0xfa142f('0x31')](_0x2e10e6['query']['fields'])),_0x279d04[_0xfa142f('0xa')]=_0x279d04[_0xfa142f('0xa')][_0xfa142f('0x61')]?_0x279d04['attributes']:_0x1acd9c['model'],typeof _0x2e10e6['query']['nolimit']==='undefined'&&(_0x279d04[_0xfa142f('0x1f')]=qs[_0xfa142f('0x1f')](_0x2e10e6['query']['limit']),_0x279d04[_0xfa142f('0x50')]=qs[_0xfa142f('0x50')](_0x2e10e6[_0xfa142f('0x5f')]['offset'])),_0x279d04[_0xfa142f('0x59')]=qs[_0xfa142f('0x3e')](_0x2e10e6[_0xfa142f('0x5f')][_0xfa142f('0x3e')]),_0x279d04[_0xfa142f('0x5')]=qs[_0xfa142f('0x17')](_['pick'](_0x2e10e6[_0xfa142f('0x5f')],_0x1acd9c['filters'])),_0x279d04[_0xfa142f('0x5')][_0xfa142f('0x52')]=_0x1fb46a['id'],_0x2e10e6[_0xfa142f('0x5f')]['filter']&&(_0x279d04[_0xfa142f('0x5')]=_['merge'](_0x279d04[_0xfa142f('0x5')],{[Op['or']]:_['map'](_0x279d04[_0xfa142f('0xa')],function(_0x14b696){const _0x41c478=_0xfa142f,_0x3bff25={};return _0x3bff25[_0x14b696]={[Op[_0x41c478('0x2b')]]:'%'+_0x2e10e6[_0x41c478('0x5f')]['filter']+'%'},_0x3bff25;})})),_0x279d04=_[_0xfa142f('0x22')]({},_0x279d04,_0x2e10e6[_0xfa142f('0x51')]),db[_0xfa142f('0x27')][_0xfa142f('0x34')]({'where':_0x279d04['where']})[_0xfa142f('0x10')](function(_0x12bd65){const _0x8bc1fa=_0xfa142f;return _0x5f5a2e['count']=_0x12bd65,_0x2e10e6['query']['includeAll']&&(_0x279d04['include']=[{'all':!![]}]),db[_0x8bc1fa('0x27')][_0x8bc1fa('0x60')](_0x279d04);})[_0xfa142f('0x10')](function(_0x3143ff){return _0x5f5a2e['rows']=_0x3143ff,_0x5f5a2e;});})[_0x4283a8('0x10')](respondWithFilteredResult(_0x4929f7,_0x279d04))[_0x4283a8('0xd')](handleError(_0x4929f7,null));},exports['getAnswers']=function(_0xb72ee2,_0x1fb5c0){const _0x16788b=_0x2c8c11;let _0x5bebd4={'raw':!![],'where':{}};const _0x3cd812={},_0x3e6ae8={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x16788b('0x4a')]({'where':{'id':_0xb72ee2[_0x16788b('0x0')]['id']}})[_0x16788b('0x10')](handleEntityNotFound(_0x1fb5c0,null))[_0x16788b('0x10')](function(_0x976f50){const _0x317d80=_0x16788b;if(_0x976f50)return _0x3cd812['model']=_['keys'](db[_0x317d80('0x4')][_0x317d80('0x5b')]),_0x3cd812[_0x317d80('0x5f')]=_[_0x317d80('0x43')](_0xb72ee2[_0x317d80('0x5f')]),_0x3cd812['filters']=_[_0x317d80('0x4e')](_0x3cd812[_0x317d80('0x1d')],_0x3cd812[_0x317d80('0x5f')]),_0x5bebd4[_0x317d80('0xa')]=_[_0x317d80('0x4e')](_0x3cd812[_0x317d80('0x1d')],qs[_0x317d80('0x31')](_0xb72ee2[_0x317d80('0x5f')][_0x317d80('0x31')])),_0x5bebd4[_0x317d80('0xa')]=_0x5bebd4['attributes'][_0x317d80('0x61')]?_0x5bebd4[_0x317d80('0xa')]:_0x3cd812[_0x317d80('0x1d')],typeof _0xb72ee2[_0x317d80('0x5f')][_0x317d80('0x1a')]==='undefined'&&(_0x5bebd4[_0x317d80('0x1f')]=qs[_0x317d80('0x1f')](_0xb72ee2['query'][_0x317d80('0x1f')]),_0x5bebd4['offset']=qs[_0x317d80('0x50')](_0xb72ee2[_0x317d80('0x5f')][_0x317d80('0x50')])),_0x5bebd4['order']=qs[_0x317d80('0x3e')](_0xb72ee2[_0x317d80('0x5f')][_0x317d80('0x3e')]),_0x5bebd4['where']=qs[_0x317d80('0x17')](_[_0x317d80('0x4b')](_0xb72ee2['query'],_0x3cd812[_0x317d80('0x17')])),_0x5bebd4[_0x317d80('0x5')]['ProjectId']=_0x976f50['id'],_0xb72ee2[_0x317d80('0x5f')][_0x317d80('0x2')]&&(_0x5bebd4[_0x317d80('0x5')]=_[_0x317d80('0x22')](_0x5bebd4[_0x317d80('0x5')],{[Op['or']]:_[_0x317d80('0x36')](_0x5bebd4['attributes'],function(_0x41ae0f){const _0x239504=_0x317d80,_0x2b6c5c={};return _0x2b6c5c[_0x41ae0f]={[Op[_0x239504('0x2b')]]:'%'+_0xb72ee2[_0x239504('0x5f')][_0x239504('0x2')]+'%'},_0x2b6c5c;})})),_0x5bebd4=_['merge']({},_0x5bebd4,_0xb72ee2[_0x317d80('0x51')]),db[_0x317d80('0x4')][_0x317d80('0x34')]({'where':_0x5bebd4[_0x317d80('0x5')]})[_0x317d80('0x10')](function(_0x269780){const _0x5bb1b4=_0x317d80;return _0x3e6ae8[_0x5bb1b4('0x34')]=_0x269780,_0xb72ee2[_0x5bb1b4('0x5f')][_0x5bb1b4('0x41')]&&(_0x5bebd4[_0x5bb1b4('0x5d')]=[{'all':!![]}]),db[_0x5bb1b4('0x4')][_0x5bb1b4('0x60')](_0x5bebd4);})[_0x317d80('0x10')](function(_0x416790){const _0x2fdaef=_0x317d80;return _0x3e6ae8[_0x2fdaef('0x3d')]=_0x416790,_0x3e6ae8;});})[_0x16788b('0x10')](respondWithFilteredResult(_0x1fb5c0,_0x5bebd4))['catch'](handleError(_0x1fb5c0,null));};function char(_0x83082a){const _0x464d89=_0x2c8c11;return _0x464d89('0x11')===typeof _0x83082a?String[_0x464d89('0x5e')]['apply'](null,arguments):_0x83082a;}function needsEncapsulation(_0x1d03cf){const _0x19c06c=_0x2c8c11;return!!_0x1d03cf&&(_0x1d03cf[_0x19c06c('0x3b')]()[_0x19c06c('0x20')](char(0xd))>=0x0||_0x1d03cf[_0x19c06c('0x3b')]()['indexOf'](char(0xa))>=0x0||_0x1d03cf[_0x19c06c('0x3b')]()[_0x19c06c('0x20')](char(0x2c))>=0x0||_0x1d03cf['toString']()[_0x19c06c('0x20')](char(0x22))>=0x0);}function encapsulate(_0x24e605){const _0x4ac1fa=_0x2c8c11,_0x1174c2=char(0x22),_0x25d918='\x5c'+char(0x22),_0x439fbf=_0x24e605['toString']()[_0x4ac1fa('0x56')](new RegExp(_0x1174c2,'g'),_0x25d918);return _0x1174c2+_0x439fbf+_0x1174c2;}exports[_0x2c8c11('0x3')]=function(_0x26cf23,_0x71b4a7){const _0x4916d2=_0x2c8c11;let _0x6fa33c,_0x17c026;const _0x3247ed={'where':{'ProjectId':_0x26cf23['params']['id']}};return _0x26cf23[_0x4916d2('0x5f')][_0x4916d2('0x39')]&&(_0x3247ed[_0x4916d2('0x5')][_0x4916d2('0xe')]=JSON[_0x4916d2('0x8')](_0x26cf23['query'][_0x4916d2('0x39')])),db[_0x4916d2('0x27')][_0x4916d2('0x60')](_0x3247ed)[_0x4916d2('0x10')](handleEntityNotFound(_0x71b4a7,null))['then'](function(_0x2eb26e){const _0x4ef5d3=_0x4916d2;if(_0x2eb26e)return _0x6fa33c=_0x2eb26e,db[_0x4ef5d3('0x4d')][_0x4ef5d3('0x60')]({'where':{'SessionId':{[Op['in']]:_[_0x4ef5d3('0x36')](_0x6fa33c,'id')},'ProjectId':_0x26cf23[_0x4ef5d3('0x0')]['id']},'order':_0x4ef5d3('0x53')});})['then'](handleEntityNotFound(_0x71b4a7,null))['then'](function(_0x226f4b){const _0x24ae2c=_0x4916d2;if(_0x226f4b){_0x17c026=_0x226f4b;const _0x5892be={};for(let _0x412a4a=0x0,_0x249db4=_0x17c026['length'];_0x412a4a<_0x249db4;_0x412a4a++){typeof _0x5892be[_0x17c026[_0x412a4a][_0x24ae2c('0x25')]]===_0x24ae2c('0x13')&&(_0x5892be[_0x17c026[_0x412a4a]['questionId']]=needsEncapsulation(_0x17c026[_0x412a4a][_0x24ae2c('0x32')])?encapsulate(_0x17c026[_0x412a4a][_0x24ae2c('0x32')]):_0x17c026[_0x412a4a][_0x24ae2c('0x32')]);}const _0x5059f4=[];let _0x5312b0={};for(let _0x1b1eb3=0x0,_0x262467=_0x6fa33c['length'];_0x1b1eb3<_0x262467;_0x1b1eb3++){_0x5312b0={'ProjectId':_0x26cf23[_0x24ae2c('0x0')]['id'],'SessionId':_0x6fa33c[_0x1b1eb3]['id'],'StartTime':moment(_0x6fa33c[_0x1b1eb3][_0x24ae2c('0xe')])[_0x24ae2c('0x63')](_0x24ae2c('0x21'))};for(let _0xe0e50=0x0,_0x4e3ae9=_0x17c026[_0x24ae2c('0x61')];_0xe0e50<_0x4e3ae9;_0xe0e50++){_0x17c026[_0xe0e50][_0x24ae2c('0x1b')]===_0x6fa33c[_0x1b1eb3]['id']&&typeof _0x5892be[_0x17c026[_0xe0e50][_0x24ae2c('0x25')]]!==_0x24ae2c('0x13')&&(_0x5312b0[_0x5892be[_0x17c026[_0xe0e50]['questionId']]]=_0x17c026[_0xe0e50][_0x24ae2c('0x2a')]);}for(const _0x513c67 in _0x5892be){typeof _0x5312b0[_0x5892be[_0x513c67]]===_0x24ae2c('0x13')&&(_0x5312b0[_0x5892be[_0x513c67]]=null);}_0x5059f4[_0x24ae2c('0x9')](_0x5312b0);}return _0x5059f4;}})['then'](function(_0x1194e8){const _0x4bf71c=_0x4916d2;if(!_[_0x4bf71c('0x23')](_0x1194e8)){const _0x2fd1ef=toCsv(_0x1194e8),_0x2862a4=Date['now']();return fs[_0x4bf71c('0x35')](util['format'](_0x4bf71c('0x7'),_0x26cf23[_0x4bf71c('0x0')]['id'],_0x2862a4),_0x2fd1ef),_0x71b4a7['setHeader'](_0x4bf71c('0x24'),_0x4bf71c('0x3c')+util[_0x4bf71c('0x63')](_0x4bf71c('0x37'),_0x26cf23[_0x4bf71c('0x0')]['id'],_0x2862a4)),_0x71b4a7['setHeader'](_0x4bf71c('0x6'),_0x4bf71c('0x40')),_0x71b4a7[_0x4bf71c('0x2f')](util[_0x4bf71c('0x63')](_0x4bf71c('0x7'),_0x26cf23['params']['id'],_0x2862a4));}else return _0x71b4a7[_0x4bf71c('0x16')](0xcc);})[_0x4916d2('0xd')](handleError(_0x71b4a7,null));};
\ No newline at end of file