Built motion from commit 459747fdfe53bbf13fbede61eeaffea1f1438f86. Version 3.0.0...
[motion-next.git] / server / api / jscriptyProject / jscriptyProject.controller.js
index 7e67888..f201578 100644 (file)
@@ -1 +1 @@
-const a378_0x2040=['createdAt','catch','pick','util','fromCharCode','send','api','offset','getAnswers','apply','like','where','number','type','undefined','/tmp/Jscripty_Project_%d_Summary_%s.csv','query','userProfileId','user','updatedAt','Content-type','download','indexOf','now','attributes','rawAttributes','status','sort','json','error','fields','push','key','destroy','to-csv','../../components/parsers/qs','setHeader','then','filter','includeAll','UserProfileResource','question','sendStatus','role','YYYY-MM-DD\x20HH:mm:ss','replace','params','Projects','text/csv','order','map','model','options','get','findOne','toString','format','SessionId','body','rows','Unable\x20to\x20retrieve\x20the\x20current\x20user','include','Content-disposition','Content-Range','starttime','update','create','autoAssociation','fieldName','stack','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','limit','-createdAt','merge','../../config/logger','JscriptyAnswerReport','ProjectId','nolimit','name','attachment;\x20filename=','filters','keys','clone','index','intersection','count','omit','questionId','show','JscriptyProject','JscriptySessionReport','JscriptyQuestionReport','findAll','moment','length','startTime','end','getSessions'];(function(_0x29c90d,_0x20404e){const _0x12da4b=function(_0x2b10d7){while(--_0x2b10d7){_0x29c90d['push'](_0x29c90d['shift']());}};_0x12da4b(++_0x20404e);}(a378_0x2040,0x148));const a378_0x12da=function(_0x29c90d,_0x20404e){_0x29c90d=_0x29c90d-0x0;let _0x12da4b=a378_0x2040[_0x29c90d];return _0x12da4b;};const _0x159b33=a378_0x12da;'use strict';const moment=require(_0x159b33('0x3f')),util=require(_0x159b33('0x47')),fs=require('fs'),_=require('lodash'),toCsv=require(_0x159b33('0x3')),qs=require(_0x159b33('0x4')),logger=require(_0x159b33('0x2c'))(_0x159b33('0x4a')),db=require('../../mysqldb')['db'],{Op}=require('sequelize');function respondWithResult(_0x2b10d7,_0x586dc2){return _0x586dc2=_0x586dc2||0xc8,function(_0x24af96){const _0x535825=a378_0x12da;if(_0x24af96)return _0x2b10d7[_0x535825('0x5e')](_0x586dc2)[_0x535825('0x60')](_0x24af96);};}function respondWithFilteredResult(_0x1debfc,_0xda2d05){return function(_0x232416){const _0x5c6c15=a378_0x12da;if(_0x232416){const _0x5090e8=_0x232416[_0x5c6c15('0x37')],_0x48ebe2=_0xda2d05[_0x5c6c15('0x4b')];let _0x293f22=_0xda2d05[_0x5c6c15('0x4b')]+_0xda2d05[_0x5c6c15('0x29')],_0x2b0db0;return _0x293f22>=_0x5090e8?(_0x293f22=_0x5090e8,_0x2b0db0=0xc8):_0x2b0db0=0xce,_0x1debfc[_0x5c6c15('0x5e')](_0x2b0db0),_0x1debfc['set'](_0x5c6c15('0x20'),_0x48ebe2+'-'+_0x293f22+'/'+_0x5090e8)[_0x5c6c15('0x60')](_0x232416);}return null;};}function saveUpdates(_0x224e4d){return function(_0x1ae066){if(_0x1ae066)return _0x1ae066['update'](_0x224e4d)['then'](function(_0x5e3989){return _0x5e3989;});return null;};}function removeEntity(_0x41746b){return function(_0x42eabe){const _0x340075=a378_0x12da;if(_0x42eabe)return _0x42eabe[_0x340075('0x2')]()['then'](function(){const _0x33366d=_0x340075,_0x1b53bb=_0x42eabe['get']({'plain':!![]}),_0x1fc143=_0x33366d('0x10');return db[_0x33366d('0x9')][_0x33366d('0x2')]({'where':{'type':_0x1fc143,'resourceId':_0x1b53bb['id']}})['then'](function(){return _0x42eabe;});})[_0x340075('0x6')](function(){const _0x2d1c58=_0x340075;_0x41746b[_0x2d1c58('0x5e')](0xcc)[_0x2d1c58('0x42')]();});};}function handleEntityNotFound(_0x2f2231){return function(_0x2a1a85){return!_0x2a1a85&&_0x2f2231['sendStatus'](0x194),_0x2a1a85;};}function handleError(_0x44fbd4,_0x471f68){return _0x471f68=_0x471f68||0x1f4,function(_0x47d932){const _0x497125=a378_0x12da;logger[_0x497125('0x61')](_0x47d932[_0x497125('0x26')]),_0x47d932['name']&&delete _0x47d932[_0x497125('0x30')],_0x44fbd4[_0x497125('0x5e')](_0x471f68)[_0x497125('0x49')](_0x47d932);};}exports[_0x159b33('0x35')]=function(_0x3ed6bc,_0x336c93){const _0x5e0893=_0x159b33;let _0x57aaa6={};const _0x1790f3={},_0x470678={'count':0x0,'rows':[]},_0x42928b=_[_0x5e0893('0x13')](db[_0x5e0893('0x3b')]['rawAttributes'],function(_0x142e89){const _0x181d8d=_0x5e0893;return{'name':_0x142e89[_0x181d8d('0x25')],'type':_0x142e89[_0x181d8d('0x51')][_0x181d8d('0x1')]};});_0x1790f3['model']=_[_0x5e0893('0x13')](_0x42928b,_0x5e0893('0x30')),_0x1790f3['query']=_[_0x5e0893('0x33')](_0x3ed6bc[_0x5e0893('0x54')]),_0x1790f3['filters']=_[_0x5e0893('0x36')](_0x1790f3[_0x5e0893('0x14')],_0x1790f3[_0x5e0893('0x54')]),_0x57aaa6[_0x5e0893('0x5c')]=_['intersection'](_0x1790f3['model'],qs[_0x5e0893('0x62')](_0x3ed6bc[_0x5e0893('0x54')][_0x5e0893('0x62')])),_0x57aaa6['attributes']=_0x57aaa6['attributes'][_0x5e0893('0x40')]?_0x57aaa6[_0x5e0893('0x5c')]:_0x1790f3['model'];typeof _0x3ed6bc[_0x5e0893('0x54')][_0x5e0893('0x2f')]==='undefined'&&(_0x57aaa6[_0x5e0893('0x29')]=qs['limit'](_0x3ed6bc[_0x5e0893('0x54')][_0x5e0893('0x29')]),_0x57aaa6[_0x5e0893('0x4b')]=qs[_0x5e0893('0x4b')](_0x3ed6bc['query'][_0x5e0893('0x4b')]));_0x57aaa6[_0x5e0893('0x12')]=qs[_0x5e0893('0x5f')](_0x3ed6bc[_0x5e0893('0x54')][_0x5e0893('0x5f')]),_0x57aaa6['where']=qs[_0x5e0893('0x32')](_['pick'](_0x3ed6bc[_0x5e0893('0x54')],_0x1790f3[_0x5e0893('0x32')]),_0x42928b);_0x3ed6bc[_0x5e0893('0x54')][_0x5e0893('0x7')]&&(_0x57aaa6[_0x5e0893('0x4f')]=_[_0x5e0893('0x2b')](_0x57aaa6['where'],{[Op['or']]:_[_0x5e0893('0x13')](_0x42928b,function(_0x3add10){const _0x38a832=_0x5e0893;if(_0x3add10[_0x38a832('0x51')]!=='VIRTUAL'){const _0x3724b2={};return _0x3724b2[_0x3add10[_0x38a832('0x30')]]={[Op['like']]:'%'+_0x3ed6bc[_0x38a832('0x54')]['filter']+'%'},_0x3724b2;}})}));_0x57aaa6=_[_0x5e0893('0x2b')]({},_0x57aaa6,_0x3ed6bc['options']);const _0x442f8b={'where':_0x57aaa6[_0x5e0893('0x4f')]};return db[_0x5e0893('0x3b')][_0x5e0893('0x37')](_0x442f8b)[_0x5e0893('0x6')](function(_0x29c7f2){const _0x224033=_0x5e0893;return _0x470678[_0x224033('0x37')]=_0x29c7f2,_0x3ed6bc[_0x224033('0x54')][_0x224033('0x8')]&&(_0x57aaa6[_0x224033('0x1e')]=[{'all':!![]}]),db[_0x224033('0x3b')][_0x224033('0x3e')](_0x57aaa6);})['then'](function(_0x2f147e){const _0x1e165c=_0x5e0893;return _0x470678[_0x1e165c('0x1c')]=_0x2f147e,_0x470678;})[_0x5e0893('0x6')](respondWithFilteredResult(_0x336c93,_0x57aaa6))[_0x5e0893('0x45')](handleError(_0x336c93,null));},exports[_0x159b33('0x3a')]=function(_0xa19c70,_0x366a92){const _0x4cf1e0=_0x159b33;let _0x46e48a={'raw':![],'where':{'id':_0xa19c70[_0x4cf1e0('0xf')]['id']}};const _0x56a4a5={};return _0x56a4a5['model']=_[_0x4cf1e0('0x33')](db['JscriptyProject']['rawAttributes']),_0x56a4a5[_0x4cf1e0('0x54')]=_[_0x4cf1e0('0x33')](_0xa19c70[_0x4cf1e0('0x54')]),_0x56a4a5[_0x4cf1e0('0x32')]=_[_0x4cf1e0('0x36')](_0x56a4a5[_0x4cf1e0('0x14')],_0x56a4a5[_0x4cf1e0('0x54')]),_0x46e48a['attributes']=_['intersection'](_0x56a4a5[_0x4cf1e0('0x14')],qs[_0x4cf1e0('0x62')](_0xa19c70['query'][_0x4cf1e0('0x62')])),_0x46e48a[_0x4cf1e0('0x5c')]=_0x46e48a[_0x4cf1e0('0x5c')][_0x4cf1e0('0x40')]?_0x46e48a['attributes']:_0x56a4a5['model'],_0xa19c70[_0x4cf1e0('0x54')][_0x4cf1e0('0x8')]&&(_0x46e48a[_0x4cf1e0('0x1e')]=[{'all':!![]}]),_0x46e48a=_[_0x4cf1e0('0x2b')]({},_0x46e48a,_0xa19c70[_0x4cf1e0('0x15')]),db[_0x4cf1e0('0x3b')]['findOne'](_0x46e48a)[_0x4cf1e0('0x6')](handleEntityNotFound(_0x366a92,null))[_0x4cf1e0('0x6')](respondWithResult(_0x366a92,null))[_0x4cf1e0('0x45')](handleError(_0x366a92,null));},exports[_0x159b33('0x23')]=function(_0x530636,_0x29600a){const _0x4b5b1d=_0x159b33;return db[_0x4b5b1d('0x3b')][_0x4b5b1d('0x23')](_0x530636[_0x4b5b1d('0x1b')],{})[_0x4b5b1d('0x6')](function(_0x18cc9c){const _0x412a29=_0x4b5b1d,_0x28e393=_0x530636[_0x412a29('0x56')][_0x412a29('0x16')]({'plain':!![]});if(!_0x28e393)throw new Error(_0x412a29('0x1d'));if(_0x28e393[_0x412a29('0xc')]===_0x412a29('0x56')){const _0x38bf60=_0x18cc9c['get']({'plain':!![]}),_0x3536d7='Projects';return db[_0x412a29('0x27')][_0x412a29('0x17')]({'where':{'name':_0x3536d7,'userProfileId':_0x28e393[_0x412a29('0x55')]},'raw':!![]})[_0x412a29('0x6')](function(_0x13b69f){const _0x3d7304=_0x412a29;return _0x13b69f&&_0x13b69f['autoAssociation']===0x0?db[_0x3d7304('0x9')]['create']({'name':_0x38bf60[_0x3d7304('0x30')],'resourceId':_0x38bf60['id'],'type':_0x13b69f[_0x3d7304('0x30')],'sectionId':_0x13b69f['id']},{})[_0x3d7304('0x6')](function(){return _0x18cc9c;}):_0x18cc9c;})[_0x412a29('0x45')](function(_0x4d78de){const _0x43123b=_0x412a29;logger[_0x43123b('0x61')](_0x43123b('0x28'),_0x4d78de);throw _0x4d78de;});}return _0x18cc9c;})['then'](respondWithResult(_0x29600a,0xc9))[_0x4b5b1d('0x45')](handleError(_0x29600a,null));},exports[_0x159b33('0x34')]=function(_0x404bb5,_0x1fb1f2){const _0x24fdfd=_0x159b33;let _0x2677c3={'where':{'id':_0x404bb5[_0x24fdfd('0xf')]['id']}};const _0x568988={};return _0x568988['model']=_[_0x24fdfd('0x33')](db[_0x24fdfd('0x3b')][_0x24fdfd('0x5d')]),_0x2677c3[_0x24fdfd('0x5c')]=_['intersection'](_0x568988[_0x24fdfd('0x14')],qs[_0x24fdfd('0x62')](_0x404bb5['query'][_0x24fdfd('0x62')])),_0x2677c3[_0x24fdfd('0x5c')]=_0x2677c3[_0x24fdfd('0x5c')][_0x24fdfd('0x40')]?_0x2677c3[_0x24fdfd('0x5c')]:_0x568988[_0x24fdfd('0x14')],_0x404bb5[_0x24fdfd('0x54')][_0x24fdfd('0x8')]&&(_0x2677c3[_0x24fdfd('0x1e')]=[{'all':!![]}]),_0x2677c3=_[_0x24fdfd('0x2b')]({},_0x2677c3,_0x404bb5[_0x24fdfd('0x15')]),db[_0x24fdfd('0x3b')][_0x24fdfd('0x17')](_0x2677c3)[_0x24fdfd('0x6')](handleEntityNotFound(_0x1fb1f2,null))['then'](function(_0x48938a){const _0x2ecf9b=_0x24fdfd;if(_0x48938a){let _0x4ebe3d=_0x48938a[_0x2ecf9b('0x16')]({'plain':!![]});return _0x4ebe3d=qs[_0x2ecf9b('0x38')](_0x4ebe3d,['id',_0x2ecf9b('0x44'),_0x2ecf9b('0x57')]),_0x404bb5[_0x2ecf9b('0x1b')]=_['omit'](_0x404bb5[_0x2ecf9b('0x1b')],['id',_0x2ecf9b('0x44'),_0x2ecf9b('0x57')]),db[_0x2ecf9b('0x3b')][_0x2ecf9b('0x23')](_['merge'](_0x4ebe3d,_0x404bb5[_0x2ecf9b('0x1b')]),{'include':_0x404bb5['query'][_0x2ecf9b('0x8')]?[{'all':!![]}]:undefined})[_0x2ecf9b('0x6')](function(_0x46514d){const _0x449d6e=_0x2ecf9b,_0x5df3c7=_0x404bb5[_0x449d6e('0x56')][_0x449d6e('0x16')]({'plain':!![]});if(!_0x5df3c7)throw new Error(_0x449d6e('0x1d'));if(_0x5df3c7['role']===_0x449d6e('0x56')){const _0x356200=_0x46514d['get']({'plain':!![]}),_0x54f5ff=_0x449d6e('0x10');return db[_0x449d6e('0x27')]['findOne']({'where':{'name':_0x54f5ff,'userProfileId':_0x5df3c7[_0x449d6e('0x55')]},'raw':!![]})[_0x449d6e('0x6')](function(_0x255ff){const _0x4a940f=_0x449d6e;return _0x255ff&&_0x255ff[_0x4a940f('0x24')]===0x0?db['UserProfileResource']['create']({'name':_0x356200[_0x4a940f('0x30')],'resourceId':_0x356200['id'],'type':_0x255ff[_0x4a940f('0x30')],'sectionId':_0x255ff['id']},{})[_0x4a940f('0x6')](function(){return _0x46514d;}):_0x46514d;})[_0x449d6e('0x45')](function(_0x4c51c5){const _0x304ee0=_0x449d6e;logger[_0x304ee0('0x61')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c51c5);throw _0x4c51c5;});}return _0x46514d;});}})[_0x24fdfd('0x6')](respondWithResult(_0x1fb1f2,0xc9))['catch'](handleError(_0x1fb1f2,null));},exports[_0x159b33('0x22')]=function(_0x44b265,_0x2215c5){const _0x34b18c=_0x159b33;return _0x44b265[_0x34b18c('0x1b')]['id']&&delete _0x44b265['body']['id'],db['JscriptyProject']['findOne']({'where':{'id':_0x44b265['params']['id']}})['then'](handleEntityNotFound(_0x2215c5,null))[_0x34b18c('0x6')](saveUpdates(_0x44b265[_0x34b18c('0x1b')],null))['then'](respondWithResult(_0x2215c5,null))['catch'](handleError(_0x2215c5,null));},exports['destroy']=function(_0x55a7d5,_0x57db53){const _0x4c0302=_0x159b33;return db[_0x4c0302('0x3b')][_0x4c0302('0x17')]({'where':{'id':_0x55a7d5['params']['id']}})[_0x4c0302('0x6')](handleEntityNotFound(_0x57db53,null))['then'](removeEntity(_0x57db53,null))[_0x4c0302('0x45')](handleError(_0x57db53,null));},exports[_0x159b33('0x43')]=function(_0x5ab3ac,_0xa55f1d){const _0x1422b4=_0x159b33;let _0x450665={'raw':!![],'where':{}};const _0x24940f={},_0x10db35={'count':0x0,'rows':[]};return db[_0x1422b4('0x3b')]['findOne']({'where':{'id':_0x5ab3ac[_0x1422b4('0xf')]['id']}})[_0x1422b4('0x6')](handleEntityNotFound(_0xa55f1d,null))[_0x1422b4('0x6')](function(_0x36e486){const _0x523c15=_0x1422b4;if(_0x36e486)return _0x24940f['model']=_['keys'](db['JscriptySessionReport']['rawAttributes']),_0x24940f['query']=_[_0x523c15('0x33')](_0x5ab3ac[_0x523c15('0x54')]),_0x24940f[_0x523c15('0x32')]=_[_0x523c15('0x36')](_0x24940f[_0x523c15('0x14')],_0x24940f[_0x523c15('0x54')]),_0x450665[_0x523c15('0x5c')]=_[_0x523c15('0x36')](_0x24940f[_0x523c15('0x14')],qs['fields'](_0x5ab3ac['query'][_0x523c15('0x62')])),_0x450665[_0x523c15('0x5c')]=_0x450665[_0x523c15('0x5c')][_0x523c15('0x40')]?_0x450665[_0x523c15('0x5c')]:_0x24940f['model'],typeof _0x5ab3ac['query'][_0x523c15('0x2f')]===_0x523c15('0x52')&&(_0x450665[_0x523c15('0x29')]=qs[_0x523c15('0x29')](_0x5ab3ac[_0x523c15('0x54')][_0x523c15('0x29')]),_0x450665['offset']=qs[_0x523c15('0x4b')](_0x5ab3ac['query'][_0x523c15('0x4b')])),_0x450665[_0x523c15('0x12')]=qs[_0x523c15('0x5f')](_0x5ab3ac[_0x523c15('0x54')][_0x523c15('0x5f')]),_0x450665['where']=qs[_0x523c15('0x32')](_[_0x523c15('0x46')](_0x5ab3ac['query'],_0x24940f['filters'])),_0x450665[_0x523c15('0x4f')][_0x523c15('0x2e')]=_0x36e486['id'],_0x5ab3ac[_0x523c15('0x54')]['filter']&&(_0x450665[_0x523c15('0x4f')]=_['merge'](_0x450665[_0x523c15('0x4f')],{[Op['or']]:_['map'](_0x450665[_0x523c15('0x5c')],function(_0x1b3ad2){const _0x105682=_0x523c15,_0x1bc0f6={};return _0x1bc0f6[_0x1b3ad2]={[Op[_0x105682('0x4e')]]:'%'+_0x5ab3ac['query'][_0x105682('0x7')]+'%'},_0x1bc0f6;})})),_0x450665=_[_0x523c15('0x2b')]({},_0x450665,_0x5ab3ac[_0x523c15('0x15')]),db[_0x523c15('0x3c')][_0x523c15('0x37')]({'where':_0x450665[_0x523c15('0x4f')]})[_0x523c15('0x6')](function(_0x21222d){const _0x50bab6=_0x523c15;return _0x10db35[_0x50bab6('0x37')]=_0x21222d,_0x5ab3ac[_0x50bab6('0x54')][_0x50bab6('0x8')]&&(_0x450665[_0x50bab6('0x1e')]=[{'all':!![]}]),db[_0x50bab6('0x3c')][_0x50bab6('0x3e')](_0x450665);})[_0x523c15('0x6')](function(_0x558e81){const _0x50cb4d=_0x523c15;return _0x10db35[_0x50cb4d('0x1c')]=_0x558e81,_0x10db35;});})[_0x1422b4('0x6')](respondWithFilteredResult(_0xa55f1d,_0x450665))[_0x1422b4('0x45')](handleError(_0xa55f1d,null));},exports[_0x159b33('0x4c')]=function(_0x187845,_0xdd0271){const _0xfc60fc=_0x159b33;let _0x23217c={'raw':!![],'where':{}};const _0x21fada={},_0x5406e5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xfc60fc('0x17')]({'where':{'id':_0x187845['params']['id']}})['then'](handleEntityNotFound(_0xdd0271,null))['then'](function(_0x4ab86){const _0x3cb14f=_0xfc60fc;if(_0x4ab86)return _0x21fada[_0x3cb14f('0x14')]=_[_0x3cb14f('0x33')](db[_0x3cb14f('0x2d')][_0x3cb14f('0x5d')]),_0x21fada[_0x3cb14f('0x54')]=_[_0x3cb14f('0x33')](_0x187845[_0x3cb14f('0x54')]),_0x21fada[_0x3cb14f('0x32')]=_[_0x3cb14f('0x36')](_0x21fada[_0x3cb14f('0x14')],_0x21fada[_0x3cb14f('0x54')]),_0x23217c['attributes']=_[_0x3cb14f('0x36')](_0x21fada[_0x3cb14f('0x14')],qs[_0x3cb14f('0x62')](_0x187845[_0x3cb14f('0x54')][_0x3cb14f('0x62')])),_0x23217c[_0x3cb14f('0x5c')]=_0x23217c[_0x3cb14f('0x5c')][_0x3cb14f('0x40')]?_0x23217c[_0x3cb14f('0x5c')]:_0x21fada['model'],typeof _0x187845[_0x3cb14f('0x54')]['nolimit']===_0x3cb14f('0x52')&&(_0x23217c[_0x3cb14f('0x29')]=qs['limit'](_0x187845[_0x3cb14f('0x54')][_0x3cb14f('0x29')]),_0x23217c['offset']=qs[_0x3cb14f('0x4b')](_0x187845[_0x3cb14f('0x54')][_0x3cb14f('0x4b')])),_0x23217c['order']=qs['sort'](_0x187845[_0x3cb14f('0x54')][_0x3cb14f('0x5f')]),_0x23217c['where']=qs[_0x3cb14f('0x32')](_['pick'](_0x187845[_0x3cb14f('0x54')],_0x21fada[_0x3cb14f('0x32')])),_0x23217c[_0x3cb14f('0x4f')]['ProjectId']=_0x4ab86['id'],_0x187845[_0x3cb14f('0x54')][_0x3cb14f('0x7')]&&(_0x23217c[_0x3cb14f('0x4f')]=_['merge'](_0x23217c[_0x3cb14f('0x4f')],{[Op['or']]:_[_0x3cb14f('0x13')](_0x23217c[_0x3cb14f('0x5c')],function(_0x590de1){const _0x4326fd=_0x3cb14f,_0x41171f={};return _0x41171f[_0x590de1]={[Op['like']]:'%'+_0x187845[_0x4326fd('0x54')]['filter']+'%'},_0x41171f;})})),_0x23217c=_[_0x3cb14f('0x2b')]({},_0x23217c,_0x187845[_0x3cb14f('0x15')]),db[_0x3cb14f('0x2d')][_0x3cb14f('0x37')]({'where':_0x23217c[_0x3cb14f('0x4f')]})['then'](function(_0x58941e){const _0x339f57=_0x3cb14f;return _0x5406e5[_0x339f57('0x37')]=_0x58941e,_0x187845['query'][_0x339f57('0x8')]&&(_0x23217c['include']=[{'all':!![]}]),db['JscriptyAnswerReport'][_0x339f57('0x3e')](_0x23217c);})[_0x3cb14f('0x6')](function(_0x531635){const _0x4aed34=_0x3cb14f;return _0x5406e5[_0x4aed34('0x1c')]=_0x531635,_0x5406e5;});})[_0xfc60fc('0x6')](respondWithFilteredResult(_0xdd0271,_0x23217c))[_0xfc60fc('0x45')](handleError(_0xdd0271,null));};function char(_0x578966){const _0xd07324=_0x159b33;return _0xd07324('0x50')===typeof _0x578966?String[_0xd07324('0x48')][_0xd07324('0x4d')](null,arguments):_0x578966;}function needsEncapsulation(_0x20537d){const _0x812f58=_0x159b33;return!!_0x20537d&&(_0x20537d[_0x812f58('0x18')]()[_0x812f58('0x5a')](char(0xd))>=0x0||_0x20537d[_0x812f58('0x18')]()[_0x812f58('0x5a')](char(0xa))>=0x0||_0x20537d[_0x812f58('0x18')]()[_0x812f58('0x5a')](char(0x2c))>=0x0||_0x20537d[_0x812f58('0x18')]()[_0x812f58('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x58594d){const _0x6b6ac7=_0x159b33,_0x5a9990=char(0x22),_0x3d90bf='\x5c'+char(0x22),_0x298d47=_0x58594d[_0x6b6ac7('0x18')]()[_0x6b6ac7('0xe')](new RegExp(_0x5a9990,'g'),_0x3d90bf);return _0x5a9990+_0x298d47+_0x5a9990;}exports['getSummary']=function(_0x58b02d,_0x13798f){const _0x14da6a=_0x159b33;let _0x3ae841,_0x37606a;const _0x2c40b7={'where':{'ProjectId':_0x58b02d[_0x14da6a('0xf')]['id']}};return _0x58b02d[_0x14da6a('0x54')][_0x14da6a('0x41')]&&(_0x2c40b7['where'][_0x14da6a('0x21')]=JSON['parse'](_0x58b02d['query'][_0x14da6a('0x41')])),db['JscriptySessionReport'][_0x14da6a('0x3e')](_0x2c40b7)['then'](handleEntityNotFound(_0x13798f,null))[_0x14da6a('0x6')](function(_0x37d0c4){const _0x333168=_0x14da6a;if(_0x37d0c4)return _0x3ae841=_0x37d0c4,db[_0x333168('0x3d')]['findAll']({'where':{'SessionId':{[Op['in']]:_[_0x333168('0x13')](_0x3ae841,'id')},'ProjectId':_0x58b02d[_0x333168('0xf')]['id']},'order':_0x333168('0x2a')});})[_0x14da6a('0x6')](handleEntityNotFound(_0x13798f,null))['then'](function(_0x28053e){const _0x36f10c=_0x14da6a;if(_0x28053e){_0x37606a=_0x28053e;const _0x3977c8={};for(let _0x1c5b60=0x0,_0x4aee41=_0x37606a['length'];_0x1c5b60<_0x4aee41;_0x1c5b60++){typeof _0x3977c8[_0x37606a[_0x1c5b60][_0x36f10c('0x39')]]===_0x36f10c('0x52')&&(_0x3977c8[_0x37606a[_0x1c5b60][_0x36f10c('0x39')]]=needsEncapsulation(_0x37606a[_0x1c5b60][_0x36f10c('0xa')])?encapsulate(_0x37606a[_0x1c5b60][_0x36f10c('0xa')]):_0x37606a[_0x1c5b60][_0x36f10c('0xa')]);}const _0x284a74=[];let _0x1a2df3={};for(let _0x23c755=0x0,_0x4fadb7=_0x3ae841[_0x36f10c('0x40')];_0x23c755<_0x4fadb7;_0x23c755++){_0x1a2df3={'ProjectId':_0x58b02d[_0x36f10c('0xf')]['id'],'SessionId':_0x3ae841[_0x23c755]['id'],'StartTime':moment(_0x3ae841[_0x23c755][_0x36f10c('0x21')])[_0x36f10c('0x19')](_0x36f10c('0xd'))};for(let _0x3f4a70=0x0,_0x43ca23=_0x37606a[_0x36f10c('0x40')];_0x3f4a70<_0x43ca23;_0x3f4a70++){_0x37606a[_0x3f4a70][_0x36f10c('0x1a')]===_0x3ae841[_0x23c755]['id']&&typeof _0x3977c8[_0x37606a[_0x3f4a70][_0x36f10c('0x39')]]!=='undefined'&&(_0x1a2df3[_0x3977c8[_0x37606a[_0x3f4a70]['questionId']]]=_0x37606a[_0x3f4a70]['answer']);}for(const _0x11b386 in _0x3977c8){typeof _0x1a2df3[_0x3977c8[_0x11b386]]==='undefined'&&(_0x1a2df3[_0x3977c8[_0x11b386]]=null);}_0x284a74[_0x36f10c('0x0')](_0x1a2df3);}return _0x284a74;}})[_0x14da6a('0x6')](function(_0x4243b2){const _0x3c5e59=_0x14da6a;if(!_['isEmpty'](_0x4243b2)){const _0x7d6883=toCsv(_0x4243b2),_0x9f9a0a=Date[_0x3c5e59('0x5b')]();return fs['writeFileSync'](util['format'](_0x3c5e59('0x53'),_0x58b02d[_0x3c5e59('0xf')]['id'],_0x9f9a0a),_0x7d6883),_0x13798f[_0x3c5e59('0x5')](_0x3c5e59('0x1f'),_0x3c5e59('0x31')+util[_0x3c5e59('0x19')]('Jscripty_Project_%d_Summary_%s.csv',_0x58b02d[_0x3c5e59('0xf')]['id'],_0x9f9a0a)),_0x13798f[_0x3c5e59('0x5')](_0x3c5e59('0x58'),_0x3c5e59('0x11')),_0x13798f[_0x3c5e59('0x59')](util['format'](_0x3c5e59('0x53'),_0x58b02d[_0x3c5e59('0xf')]['id'],_0x9f9a0a));}else return _0x13798f[_0x3c5e59('0xb')](0xcc);})['catch'](handleError(_0x13798f,null));};
\ No newline at end of file
+const a378_0xa3d1=['index','offset','sendStatus','map','api','end','JscriptyQuestionReport','keys','questionId','setHeader','rawAttributes','fromCharCode','question','updatedAt','fields','startTime','merge','filter','attributes','findOne','params','now','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','-createdAt','parse','body','fieldName','user','error','download','limit','where','../../mysqldb','toString','Projects','Content-disposition','JscriptyAnswerReport','findAll','then','replace','answer','send','UserProfileResource','show','nolimit','push','order','type','model','includeAll','JscriptySessionReport','json','Unable\x20to\x20retrieve\x20the\x20current\x20user','destroy','apply','Content-type','starttime','../../config/logger','stack','autoAssociation','update','role','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','sort','YYYY-MM-DD\x20HH:mm:ss','getSummary','intersection','VIRTUAL','userProfileId','filters','omit','JscriptyProject','options','catch','key','status','query','createdAt','moment','like','lodash','undefined','get','length','create','count','pick','set','format','getSessions','UserProfileSection','indexOf','util','name','rows'];(function(_0x1fac50,_0xa3d199){const _0x4891cc=function(_0x3c96e6){while(--_0x3c96e6){_0x1fac50['push'](_0x1fac50['shift']());}};_0x4891cc(++_0xa3d199);}(a378_0xa3d1,0xbf));const a378_0x4891=function(_0x1fac50,_0xa3d199){_0x1fac50=_0x1fac50-0x0;let _0x4891cc=a378_0xa3d1[_0x1fac50];return _0x4891cc;};const _0x463905=a378_0x4891;'use strict';const moment=require(_0x463905('0x56')),util=require(_0x463905('0x2')),fs=require('fs'),_=require(_0x463905('0x58')),toCsv=require('to-csv'),qs=require('../../components/parsers/qs'),logger=require(_0x463905('0x3f'))(_0x463905('0x9')),db=require(_0x463905('0x26'))['db'],{Op}=require('sequelize');function respondWithResult(_0x3c96e6,_0x4c4c72){return _0x4c4c72=_0x4c4c72||0xc8,function(_0x419417){const _0x3af4d2=a378_0x4891;if(_0x419417)return _0x3c96e6[_0x3af4d2('0x53')](_0x4c4c72)[_0x3af4d2('0x39')](_0x419417);};}function respondWithFilteredResult(_0x58b734,_0x28b49b){return function(_0x75d3d7){const _0x3b0a4c=a378_0x4891;if(_0x75d3d7){const _0x2cf5cf=_0x75d3d7['count'],_0x26e2c8=_0x28b49b[_0x3b0a4c('0x6')];let _0x35b179=_0x28b49b[_0x3b0a4c('0x6')]+_0x28b49b['limit'],_0x91b400;return _0x35b179>=_0x2cf5cf?(_0x35b179=_0x2cf5cf,_0x91b400=0xc8):_0x91b400=0xce,_0x58b734[_0x3b0a4c('0x53')](_0x91b400),_0x58b734[_0x3b0a4c('0x5f')]('Content-Range',_0x26e2c8+'-'+_0x35b179+'/'+_0x2cf5cf)[_0x3b0a4c('0x39')](_0x75d3d7);}return null;};}function saveUpdates(_0x5a90a3){return function(_0x22f32a){const _0x2b06e5=a378_0x4891;if(_0x22f32a)return _0x22f32a[_0x2b06e5('0x42')](_0x5a90a3)[_0x2b06e5('0x2c')](function(_0x350729){return _0x350729;});return null;};}function removeEntity(_0x3b9ee3){return function(_0x197274){const _0x2c5dc8=a378_0x4891;if(_0x197274)return _0x197274[_0x2c5dc8('0x3b')]()[_0x2c5dc8('0x2c')](function(){const _0x2d7b0a=_0x2c5dc8,_0x7b22d5=_0x197274[_0x2d7b0a('0x5a')]({'plain':!![]}),_0x1a1301=_0x2d7b0a('0x28');return db[_0x2d7b0a('0x30')]['destroy']({'where':{'type':_0x1a1301,'resourceId':_0x7b22d5['id']}})['then'](function(){return _0x197274;});})['then'](function(){const _0x3a47c1=_0x2c5dc8;_0x3b9ee3[_0x3a47c1('0x53')](0xcc)[_0x3a47c1('0xa')]();});};}function handleEntityNotFound(_0x5d3428){return function(_0x187cc1){const _0x43c833=a378_0x4891;return!_0x187cc1&&_0x5d3428[_0x43c833('0x7')](0x194),_0x187cc1;};}function handleError(_0x3d4729,_0x184bd4){return _0x184bd4=_0x184bd4||0x1f4,function(_0x1d35e7){const _0x3258fb=a378_0x4891;logger['error'](_0x1d35e7[_0x3258fb('0x40')]),_0x1d35e7[_0x3258fb('0x3')]&&delete _0x1d35e7['name'],_0x3d4729[_0x3258fb('0x53')](_0x184bd4)[_0x3258fb('0x2f')](_0x1d35e7);};}exports[_0x463905('0x5')]=function(_0x2576e6,_0x198ac4){const _0x57e124=_0x463905;let _0x132cf7={};const _0x4ae07f={},_0x1fe1ac={'count':0x0,'rows':[]},_0x50d885=_[_0x57e124('0x8')](db[_0x57e124('0x4f')][_0x57e124('0xf')],function(_0x5f20a1){const _0x221c10=_0x57e124;return{'name':_0x5f20a1[_0x221c10('0x20')],'type':_0x5f20a1[_0x221c10('0x35')][_0x221c10('0x52')]};});_0x4ae07f[_0x57e124('0x36')]=_[_0x57e124('0x8')](_0x50d885,_0x57e124('0x3')),_0x4ae07f['query']=_[_0x57e124('0xc')](_0x2576e6['query']),_0x4ae07f['filters']=_[_0x57e124('0x4a')](_0x4ae07f[_0x57e124('0x36')],_0x4ae07f[_0x57e124('0x54')]),_0x132cf7[_0x57e124('0x17')]=_['intersection'](_0x4ae07f[_0x57e124('0x36')],qs['fields'](_0x2576e6[_0x57e124('0x54')][_0x57e124('0x13')])),_0x132cf7[_0x57e124('0x17')]=_0x132cf7[_0x57e124('0x17')][_0x57e124('0x5b')]?_0x132cf7[_0x57e124('0x17')]:_0x4ae07f[_0x57e124('0x36')];typeof _0x2576e6[_0x57e124('0x54')]['nolimit']===_0x57e124('0x59')&&(_0x132cf7[_0x57e124('0x24')]=qs[_0x57e124('0x24')](_0x2576e6[_0x57e124('0x54')]['limit']),_0x132cf7[_0x57e124('0x6')]=qs[_0x57e124('0x6')](_0x2576e6['query'][_0x57e124('0x6')]));_0x132cf7[_0x57e124('0x34')]=qs[_0x57e124('0x47')](_0x2576e6[_0x57e124('0x54')]['sort']),_0x132cf7[_0x57e124('0x25')]=qs[_0x57e124('0x4d')](_[_0x57e124('0x5e')](_0x2576e6[_0x57e124('0x54')],_0x4ae07f['filters']),_0x50d885);_0x2576e6[_0x57e124('0x54')][_0x57e124('0x16')]&&(_0x132cf7[_0x57e124('0x25')]=_['merge'](_0x132cf7[_0x57e124('0x25')],{[Op['or']]:_[_0x57e124('0x8')](_0x50d885,function(_0x22babf){const _0x40faf0=_0x57e124;if(_0x22babf[_0x40faf0('0x35')]!==_0x40faf0('0x4b')){const _0x1139b5={};return _0x1139b5[_0x22babf[_0x40faf0('0x3')]]={[Op[_0x40faf0('0x57')]]:'%'+_0x2576e6[_0x40faf0('0x54')][_0x40faf0('0x16')]+'%'},_0x1139b5;}})}));_0x132cf7=_[_0x57e124('0x15')]({},_0x132cf7,_0x2576e6[_0x57e124('0x50')]);const _0x2cfe15={'where':_0x132cf7['where']};return db['JscriptyProject'][_0x57e124('0x5d')](_0x2cfe15)[_0x57e124('0x2c')](function(_0x5f0b01){const _0xd016de=_0x57e124;return _0x1fe1ac[_0xd016de('0x5d')]=_0x5f0b01,_0x2576e6['query'][_0xd016de('0x37')]&&(_0x132cf7[_0xd016de('0x1c')]=[{'all':!![]}]),db[_0xd016de('0x4f')][_0xd016de('0x2b')](_0x132cf7);})[_0x57e124('0x2c')](function(_0x48790b){const _0x1ad5bf=_0x57e124;return _0x1fe1ac[_0x1ad5bf('0x4')]=_0x48790b,_0x1fe1ac;})[_0x57e124('0x2c')](respondWithFilteredResult(_0x198ac4,_0x132cf7))[_0x57e124('0x51')](handleError(_0x198ac4,null));},exports[_0x463905('0x31')]=function(_0x7b6d6e,_0x1eae18){const _0x201803=_0x463905;let _0x5c6b7e={'raw':![],'where':{'id':_0x7b6d6e[_0x201803('0x19')]['id']}};const _0x2dba42={};return _0x2dba42[_0x201803('0x36')]=_['keys'](db[_0x201803('0x4f')][_0x201803('0xf')]),_0x2dba42[_0x201803('0x54')]=_[_0x201803('0xc')](_0x7b6d6e['query']),_0x2dba42['filters']=_['intersection'](_0x2dba42[_0x201803('0x36')],_0x2dba42[_0x201803('0x54')]),_0x5c6b7e['attributes']=_[_0x201803('0x4a')](_0x2dba42[_0x201803('0x36')],qs[_0x201803('0x13')](_0x7b6d6e['query'][_0x201803('0x13')])),_0x5c6b7e['attributes']=_0x5c6b7e['attributes']['length']?_0x5c6b7e[_0x201803('0x17')]:_0x2dba42[_0x201803('0x36')],_0x7b6d6e[_0x201803('0x54')]['includeAll']&&(_0x5c6b7e[_0x201803('0x1c')]=[{'all':!![]}]),_0x5c6b7e=_['merge']({},_0x5c6b7e,_0x7b6d6e[_0x201803('0x50')]),db['JscriptyProject'][_0x201803('0x18')](_0x5c6b7e)['then'](handleEntityNotFound(_0x1eae18,null))[_0x201803('0x2c')](respondWithResult(_0x1eae18,null))[_0x201803('0x51')](handleError(_0x1eae18,null));},exports[_0x463905('0x5c')]=function(_0x109042,_0xe936ff){const _0x453e95=_0x463905;return db[_0x453e95('0x4f')][_0x453e95('0x5c')](_0x109042[_0x453e95('0x1f')],{})[_0x453e95('0x2c')](function(_0x20339d){const _0x2235ad=_0x453e95,_0x5f2ab6=_0x109042[_0x2235ad('0x21')][_0x2235ad('0x5a')]({'plain':!![]});if(!_0x5f2ab6)throw new Error(_0x2235ad('0x3a'));if(_0x5f2ab6[_0x2235ad('0x43')]===_0x2235ad('0x21')){const _0x30f5e9=_0x20339d['get']({'plain':!![]}),_0x217b67=_0x2235ad('0x28');return db[_0x2235ad('0x0')][_0x2235ad('0x18')]({'where':{'name':_0x217b67,'userProfileId':_0x5f2ab6[_0x2235ad('0x4c')]},'raw':!![]})[_0x2235ad('0x2c')](function(_0x35b0d0){const _0x49d591=_0x2235ad;return _0x35b0d0&&_0x35b0d0['autoAssociation']===0x0?db[_0x49d591('0x30')][_0x49d591('0x5c')]({'name':_0x30f5e9[_0x49d591('0x3')],'resourceId':_0x30f5e9['id'],'type':_0x35b0d0[_0x49d591('0x3')],'sectionId':_0x35b0d0['id']},{})[_0x49d591('0x2c')](function(){return _0x20339d;}):_0x20339d;})[_0x2235ad('0x51')](function(_0x39efcc){const _0x45a9a8=_0x2235ad;logger[_0x45a9a8('0x22')](_0x45a9a8('0x1b'),_0x39efcc);throw _0x39efcc;});}return _0x20339d;})[_0x453e95('0x2c')](respondWithResult(_0xe936ff,0xc9))[_0x453e95('0x51')](handleError(_0xe936ff,null));},exports['clone']=function(_0x1f7cc1,_0x229d0b){const _0xba3572=_0x463905;let _0x56f3d={'where':{'id':_0x1f7cc1[_0xba3572('0x19')]['id']}};const _0x4f650a={};return _0x4f650a[_0xba3572('0x36')]=_[_0xba3572('0xc')](db[_0xba3572('0x4f')][_0xba3572('0xf')]),_0x56f3d['attributes']=_[_0xba3572('0x4a')](_0x4f650a[_0xba3572('0x36')],qs[_0xba3572('0x13')](_0x1f7cc1[_0xba3572('0x54')][_0xba3572('0x13')])),_0x56f3d[_0xba3572('0x17')]=_0x56f3d[_0xba3572('0x17')][_0xba3572('0x5b')]?_0x56f3d[_0xba3572('0x17')]:_0x4f650a[_0xba3572('0x36')],_0x1f7cc1[_0xba3572('0x54')][_0xba3572('0x37')]&&(_0x56f3d[_0xba3572('0x1c')]=[{'all':!![]}]),_0x56f3d=_[_0xba3572('0x15')]({},_0x56f3d,_0x1f7cc1[_0xba3572('0x50')]),db['JscriptyProject']['findOne'](_0x56f3d)[_0xba3572('0x2c')](handleEntityNotFound(_0x229d0b,null))[_0xba3572('0x2c')](function(_0x7f8764){const _0x130cea=_0xba3572;if(_0x7f8764){let _0x147aa8=_0x7f8764['get']({'plain':!![]});return _0x147aa8=qs[_0x130cea('0x4e')](_0x147aa8,['id','createdAt',_0x130cea('0x12')]),_0x1f7cc1['body']=_[_0x130cea('0x4e')](_0x1f7cc1[_0x130cea('0x1f')],['id',_0x130cea('0x55'),_0x130cea('0x12')]),db[_0x130cea('0x4f')][_0x130cea('0x5c')](_[_0x130cea('0x15')](_0x147aa8,_0x1f7cc1[_0x130cea('0x1f')]),{'include':_0x1f7cc1['query'][_0x130cea('0x37')]?[{'all':!![]}]:undefined})[_0x130cea('0x2c')](function(_0x34be84){const _0x349593=_0x130cea,_0x41876d=_0x1f7cc1[_0x349593('0x21')][_0x349593('0x5a')]({'plain':!![]});if(!_0x41876d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41876d[_0x349593('0x43')]===_0x349593('0x21')){const _0x226cec=_0x34be84[_0x349593('0x5a')]({'plain':!![]}),_0x5af39f=_0x349593('0x28');return db[_0x349593('0x0')][_0x349593('0x18')]({'where':{'name':_0x5af39f,'userProfileId':_0x41876d[_0x349593('0x4c')]},'raw':!![]})[_0x349593('0x2c')](function(_0x5ac9c6){const _0x4b184c=_0x349593;return _0x5ac9c6&&_0x5ac9c6[_0x4b184c('0x41')]===0x0?db[_0x4b184c('0x30')][_0x4b184c('0x5c')]({'name':_0x226cec[_0x4b184c('0x3')],'resourceId':_0x226cec['id'],'type':_0x5ac9c6[_0x4b184c('0x3')],'sectionId':_0x5ac9c6['id']},{})[_0x4b184c('0x2c')](function(){return _0x34be84;}):_0x34be84;})[_0x349593('0x51')](function(_0x44dd44){const _0x5914fb=_0x349593;logger[_0x5914fb('0x22')](_0x5914fb('0x1b'),_0x44dd44);throw _0x44dd44;});}return _0x34be84;});}})['then'](respondWithResult(_0x229d0b,0xc9))['catch'](handleError(_0x229d0b,null));},exports[_0x463905('0x42')]=function(_0x3579be,_0x52a544){const _0x3059ff=_0x463905;return _0x3579be[_0x3059ff('0x1f')]['id']&&delete _0x3579be[_0x3059ff('0x1f')]['id'],db['JscriptyProject']['findOne']({'where':{'id':_0x3579be[_0x3059ff('0x19')]['id']}})[_0x3059ff('0x2c')](handleEntityNotFound(_0x52a544,null))[_0x3059ff('0x2c')](saveUpdates(_0x3579be['body'],null))['then'](respondWithResult(_0x52a544,null))['catch'](handleError(_0x52a544,null));},exports[_0x463905('0x3b')]=function(_0x3513d6,_0x43b4d9){const _0xc14f82=_0x463905;return db['JscriptyProject'][_0xc14f82('0x18')]({'where':{'id':_0x3513d6[_0xc14f82('0x19')]['id']}})[_0xc14f82('0x2c')](handleEntityNotFound(_0x43b4d9,null))[_0xc14f82('0x2c')](removeEntity(_0x43b4d9,null))[_0xc14f82('0x51')](handleError(_0x43b4d9,null));},exports[_0x463905('0x61')]=function(_0x4a19fe,_0xa6485b){const _0x291d92=_0x463905;let _0x4549a8={'raw':!![],'where':{}};const _0x3939e3={},_0x314155={'count':0x0,'rows':[]};return db[_0x291d92('0x4f')][_0x291d92('0x18')]({'where':{'id':_0x4a19fe[_0x291d92('0x19')]['id']}})[_0x291d92('0x2c')](handleEntityNotFound(_0xa6485b,null))[_0x291d92('0x2c')](function(_0x33ef74){const _0x413775=_0x291d92;if(_0x33ef74)return _0x3939e3['model']=_[_0x413775('0xc')](db['JscriptySessionReport'][_0x413775('0xf')]),_0x3939e3[_0x413775('0x54')]=_[_0x413775('0xc')](_0x4a19fe[_0x413775('0x54')]),_0x3939e3[_0x413775('0x4d')]=_[_0x413775('0x4a')](_0x3939e3[_0x413775('0x36')],_0x3939e3[_0x413775('0x54')]),_0x4549a8[_0x413775('0x17')]=_[_0x413775('0x4a')](_0x3939e3['model'],qs[_0x413775('0x13')](_0x4a19fe['query'][_0x413775('0x13')])),_0x4549a8['attributes']=_0x4549a8[_0x413775('0x17')][_0x413775('0x5b')]?_0x4549a8[_0x413775('0x17')]:_0x3939e3[_0x413775('0x36')],typeof _0x4a19fe[_0x413775('0x54')][_0x413775('0x32')]===_0x413775('0x59')&&(_0x4549a8['limit']=qs[_0x413775('0x24')](_0x4a19fe[_0x413775('0x54')][_0x413775('0x24')]),_0x4549a8[_0x413775('0x6')]=qs[_0x413775('0x6')](_0x4a19fe[_0x413775('0x54')]['offset'])),_0x4549a8[_0x413775('0x34')]=qs[_0x413775('0x47')](_0x4a19fe[_0x413775('0x54')][_0x413775('0x47')]),_0x4549a8[_0x413775('0x25')]=qs[_0x413775('0x4d')](_['pick'](_0x4a19fe[_0x413775('0x54')],_0x3939e3[_0x413775('0x4d')])),_0x4549a8[_0x413775('0x25')]['ProjectId']=_0x33ef74['id'],_0x4a19fe[_0x413775('0x54')][_0x413775('0x16')]&&(_0x4549a8[_0x413775('0x25')]=_['merge'](_0x4549a8[_0x413775('0x25')],{[Op['or']]:_[_0x413775('0x8')](_0x4549a8['attributes'],function(_0x425a1a){const _0x5c1ed3=_0x413775,_0x2d742e={};return _0x2d742e[_0x425a1a]={[Op[_0x5c1ed3('0x57')]]:'%'+_0x4a19fe[_0x5c1ed3('0x54')]['filter']+'%'},_0x2d742e;})})),_0x4549a8=_[_0x413775('0x15')]({},_0x4549a8,_0x4a19fe[_0x413775('0x50')]),db[_0x413775('0x38')]['count']({'where':_0x4549a8[_0x413775('0x25')]})[_0x413775('0x2c')](function(_0xe51118){const _0x36f5fb=_0x413775;return _0x314155[_0x36f5fb('0x5d')]=_0xe51118,_0x4a19fe[_0x36f5fb('0x54')]['includeAll']&&(_0x4549a8['include']=[{'all':!![]}]),db['JscriptySessionReport']['findAll'](_0x4549a8);})['then'](function(_0x43969a){const _0xd6ded4=_0x413775;return _0x314155[_0xd6ded4('0x4')]=_0x43969a,_0x314155;});})[_0x291d92('0x2c')](respondWithFilteredResult(_0xa6485b,_0x4549a8))[_0x291d92('0x51')](handleError(_0xa6485b,null));},exports['getAnswers']=function(_0x308ce2,_0x357589){const _0x48d472=_0x463905;let _0x3d25a8={'raw':!![],'where':{}};const _0x1f9854={},_0x7806d8={'count':0x0,'rows':[]};return db[_0x48d472('0x4f')]['findOne']({'where':{'id':_0x308ce2[_0x48d472('0x19')]['id']}})[_0x48d472('0x2c')](handleEntityNotFound(_0x357589,null))[_0x48d472('0x2c')](function(_0x5f45ba){const _0x4ce682=_0x48d472;if(_0x5f45ba)return _0x1f9854[_0x4ce682('0x36')]=_[_0x4ce682('0xc')](db[_0x4ce682('0x2a')]['rawAttributes']),_0x1f9854['query']=_[_0x4ce682('0xc')](_0x308ce2[_0x4ce682('0x54')]),_0x1f9854[_0x4ce682('0x4d')]=_[_0x4ce682('0x4a')](_0x1f9854[_0x4ce682('0x36')],_0x1f9854[_0x4ce682('0x54')]),_0x3d25a8[_0x4ce682('0x17')]=_[_0x4ce682('0x4a')](_0x1f9854[_0x4ce682('0x36')],qs[_0x4ce682('0x13')](_0x308ce2[_0x4ce682('0x54')]['fields'])),_0x3d25a8[_0x4ce682('0x17')]=_0x3d25a8[_0x4ce682('0x17')][_0x4ce682('0x5b')]?_0x3d25a8[_0x4ce682('0x17')]:_0x1f9854['model'],typeof _0x308ce2[_0x4ce682('0x54')][_0x4ce682('0x32')]===_0x4ce682('0x59')&&(_0x3d25a8[_0x4ce682('0x24')]=qs['limit'](_0x308ce2[_0x4ce682('0x54')][_0x4ce682('0x24')]),_0x3d25a8[_0x4ce682('0x6')]=qs['offset'](_0x308ce2[_0x4ce682('0x54')][_0x4ce682('0x6')])),_0x3d25a8[_0x4ce682('0x34')]=qs[_0x4ce682('0x47')](_0x308ce2[_0x4ce682('0x54')][_0x4ce682('0x47')]),_0x3d25a8[_0x4ce682('0x25')]=qs[_0x4ce682('0x4d')](_[_0x4ce682('0x5e')](_0x308ce2[_0x4ce682('0x54')],_0x1f9854[_0x4ce682('0x4d')])),_0x3d25a8['where']['ProjectId']=_0x5f45ba['id'],_0x308ce2[_0x4ce682('0x54')][_0x4ce682('0x16')]&&(_0x3d25a8[_0x4ce682('0x25')]=_[_0x4ce682('0x15')](_0x3d25a8[_0x4ce682('0x25')],{[Op['or']]:_[_0x4ce682('0x8')](_0x3d25a8['attributes'],function(_0x40c451){const _0x4708ba=_0x4ce682,_0xc1e708={};return _0xc1e708[_0x40c451]={[Op[_0x4708ba('0x57')]]:'%'+_0x308ce2[_0x4708ba('0x54')][_0x4708ba('0x16')]+'%'},_0xc1e708;})})),_0x3d25a8=_[_0x4ce682('0x15')]({},_0x3d25a8,_0x308ce2[_0x4ce682('0x50')]),db[_0x4ce682('0x2a')][_0x4ce682('0x5d')]({'where':_0x3d25a8[_0x4ce682('0x25')]})[_0x4ce682('0x2c')](function(_0x29d623){const _0xb8a4ff=_0x4ce682;return _0x7806d8[_0xb8a4ff('0x5d')]=_0x29d623,_0x308ce2[_0xb8a4ff('0x54')][_0xb8a4ff('0x37')]&&(_0x3d25a8['include']=[{'all':!![]}]),db[_0xb8a4ff('0x2a')][_0xb8a4ff('0x2b')](_0x3d25a8);})[_0x4ce682('0x2c')](function(_0x43ab23){return _0x7806d8['rows']=_0x43ab23,_0x7806d8;});})[_0x48d472('0x2c')](respondWithFilteredResult(_0x357589,_0x3d25a8))['catch'](handleError(_0x357589,null));};function char(_0x1d63bc){const _0x224ef2=_0x463905;return'number'===typeof _0x1d63bc?String[_0x224ef2('0x10')][_0x224ef2('0x3c')](null,arguments):_0x1d63bc;}function needsEncapsulation(_0x27d573){const _0x47b304=_0x463905;return!!_0x27d573&&(_0x27d573[_0x47b304('0x27')]()['indexOf'](char(0xd))>=0x0||_0x27d573[_0x47b304('0x27')]()[_0x47b304('0x1')](char(0xa))>=0x0||_0x27d573['toString']()[_0x47b304('0x1')](char(0x2c))>=0x0||_0x27d573['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x41dee9){const _0x432785=_0x463905,_0x438c1c=char(0x22),_0x2acf6c='\x5c'+char(0x22),_0x3e848d=_0x41dee9[_0x432785('0x27')]()[_0x432785('0x2d')](new RegExp(_0x438c1c,'g'),_0x2acf6c);return _0x438c1c+_0x3e848d+_0x438c1c;}exports[_0x463905('0x49')]=function(_0x4b42a4,_0x4414d1){const _0x49424f=_0x463905;let _0x31bfb2,_0x9f6b46;const _0x23f786={'where':{'ProjectId':_0x4b42a4[_0x49424f('0x19')]['id']}};return _0x4b42a4[_0x49424f('0x54')]['startTime']&&(_0x23f786[_0x49424f('0x25')][_0x49424f('0x3e')]=JSON[_0x49424f('0x1e')](_0x4b42a4[_0x49424f('0x54')][_0x49424f('0x14')])),db[_0x49424f('0x38')][_0x49424f('0x2b')](_0x23f786)[_0x49424f('0x2c')](handleEntityNotFound(_0x4414d1,null))[_0x49424f('0x2c')](function(_0x5f1a78){const _0x5e7243=_0x49424f;if(_0x5f1a78)return _0x31bfb2=_0x5f1a78,db[_0x5e7243('0xb')]['findAll']({'where':{'SessionId':{[Op['in']]:_['map'](_0x31bfb2,'id')},'ProjectId':_0x4b42a4[_0x5e7243('0x19')]['id']},'order':_0x5e7243('0x1d')});})[_0x49424f('0x2c')](handleEntityNotFound(_0x4414d1,null))[_0x49424f('0x2c')](function(_0x2b10a0){const _0x534068=_0x49424f;if(_0x2b10a0){_0x9f6b46=_0x2b10a0;const _0x526e5e={};for(let _0x5ec3ea=0x0,_0x522215=_0x9f6b46[_0x534068('0x5b')];_0x5ec3ea<_0x522215;_0x5ec3ea++){typeof _0x526e5e[_0x9f6b46[_0x5ec3ea]['questionId']]===_0x534068('0x59')&&(_0x526e5e[_0x9f6b46[_0x5ec3ea][_0x534068('0xd')]]=needsEncapsulation(_0x9f6b46[_0x5ec3ea]['question'])?encapsulate(_0x9f6b46[_0x5ec3ea][_0x534068('0x11')]):_0x9f6b46[_0x5ec3ea][_0x534068('0x11')]);}const _0x12cb13=[];let _0x3c2108={};for(let _0x14efaa=0x0,_0x22562a=_0x31bfb2[_0x534068('0x5b')];_0x14efaa<_0x22562a;_0x14efaa++){_0x3c2108={'ProjectId':_0x4b42a4[_0x534068('0x19')]['id'],'SessionId':_0x31bfb2[_0x14efaa]['id'],'StartTime':moment(_0x31bfb2[_0x14efaa][_0x534068('0x3e')])[_0x534068('0x60')](_0x534068('0x48'))};for(let _0x1a9815=0x0,_0x653233=_0x9f6b46[_0x534068('0x5b')];_0x1a9815<_0x653233;_0x1a9815++){_0x9f6b46[_0x1a9815]['SessionId']===_0x31bfb2[_0x14efaa]['id']&&typeof _0x526e5e[_0x9f6b46[_0x1a9815]['questionId']]!=='undefined'&&(_0x3c2108[_0x526e5e[_0x9f6b46[_0x1a9815][_0x534068('0xd')]]]=_0x9f6b46[_0x1a9815][_0x534068('0x2e')]);}for(const _0xdcb73f in _0x526e5e){typeof _0x3c2108[_0x526e5e[_0xdcb73f]]==='undefined'&&(_0x3c2108[_0x526e5e[_0xdcb73f]]=null);}_0x12cb13[_0x534068('0x33')](_0x3c2108);}return _0x12cb13;}})['then'](function(_0x1c6195){const _0x26d88e=_0x49424f;if(!_['isEmpty'](_0x1c6195)){const _0x1a7d3a=toCsv(_0x1c6195),_0x38ea84=Date[_0x26d88e('0x1a')]();return fs[_0x26d88e('0x44')](util[_0x26d88e('0x60')](_0x26d88e('0x45'),_0x4b42a4[_0x26d88e('0x19')]['id'],_0x38ea84),_0x1a7d3a),_0x4414d1[_0x26d88e('0xe')](_0x26d88e('0x29'),_0x26d88e('0x46')+util[_0x26d88e('0x60')]('Jscripty_Project_%d_Summary_%s.csv',_0x4b42a4['params']['id'],_0x38ea84)),_0x4414d1[_0x26d88e('0xe')](_0x26d88e('0x3d'),'text/csv'),_0x4414d1[_0x26d88e('0x23')](util['format'](_0x26d88e('0x45'),_0x4b42a4['params']['id'],_0x38ea84));}else return _0x4414d1[_0x26d88e('0x7')](0xcc);})['catch'](handleError(_0x4414d1,null));};
\ No newline at end of file