Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / api / jscriptyProject / jscriptyProject.controller.js
index f931b3c..0a353b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f59=['map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','filter','merge','where','VIRTUAL','JscriptyProject','findAll','rows','catch','show','params','includeAll','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','hasOwnProperty','sort','pick','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','Projects','UserProfileResource','error','stack','name','index'];(function(_0x51b0c8,_0x3cbf0d){var _0x50908c=function(_0x33a4df){while(--_0x33a4df){_0x51b0c8['push'](_0x51b0c8['shift']());}};_0x50908c(++_0x3cbf0d);}(_0x0f59,0x131));var _0x90f5=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x0f59[_0x95411e];return _0x2c8718;};'use strict';var pdf=require(_0x90f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x90f5('0x1'));var zipdir=require(_0x90f5('0x2'));var jsonpatch=require(_0x90f5('0x3'));var rp=require(_0x90f5('0x4'));var moment=require(_0x90f5('0x5'));var BPromise=require(_0x90f5('0x6'));var Mustache=require(_0x90f5('0x7'));var util=require(_0x90f5('0x8'));var path=require(_0x90f5('0x9'));var sox=require(_0x90f5('0xa'));var csv=require(_0x90f5('0xb'));var ejs=require(_0x90f5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x90f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x90f5('0xe'));var deskjs=require(_0x90f5('0xf'));var toCsv=require(_0x90f5('0xb'));var querystring=require(_0x90f5('0x10'));var Papa=require(_0x90f5('0x11'));var Redis=require(_0x90f5('0x12'));var authService=require(_0x90f5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f5('0x14'));var logger=require(_0x90f5('0x15'))('api');var utils=require(_0x90f5('0x16'));var config=require(_0x90f5('0x17'));var db=require(_0x90f5('0x18'))['db'];function respondWithStatusCode(_0x4e46f4,_0x202aaf){_0x202aaf=_0x202aaf||0xcc;return function(_0x5588c2){if(_0x5588c2){return _0x4e46f4['sendStatus'](_0x202aaf);}return _0x4e46f4[_0x90f5('0x19')](_0x202aaf)[_0x90f5('0x1a')]();};}function respondWithResult(_0x6271a0,_0x180984){_0x180984=_0x180984||0xc8;return function(_0x1756d7){if(_0x1756d7){return _0x6271a0[_0x90f5('0x19')](_0x180984)[_0x90f5('0x1b')](_0x1756d7);}};}function respondWithFilteredResult(_0x3e459c,_0x552516){return function(_0x285d48){if(_0x285d48){var _0x36f7a0=_0x285d48[_0x90f5('0x1c')],_0x1ad3ce=_0x552516[_0x90f5('0x1d')],_0x103b72=_0x552516[_0x90f5('0x1d')]+_0x552516[_0x90f5('0x1e')],_0x5957e9;if(_0x103b72>=_0x36f7a0){_0x103b72=_0x36f7a0;_0x5957e9=0xc8;}else{_0x5957e9=0xce;}_0x3e459c[_0x90f5('0x19')](_0x5957e9);return _0x3e459c['set'](_0x90f5('0x1f'),_0x1ad3ce+'-'+_0x103b72+'/'+_0x36f7a0)[_0x90f5('0x1b')](_0x285d48);}return null;};}function patchUpdates(_0xbe3cdb){return function(_0x282359){try{jsonpatch[_0x90f5('0x20')](_0x282359,_0xbe3cdb,!![]);}catch(_0x1ac4dd){return BPromise[_0x90f5('0x21')](_0x1ac4dd);}return _0x282359['save']();};}function saveUpdates(_0x11d30f,_0x178e3a){return function(_0x32dc01){if(_0x32dc01){return _0x32dc01[_0x90f5('0x22')](_0x11d30f)[_0x90f5('0x23')](function(_0x1cb935){return _0x1cb935;});}return null;};}function removeEntity(_0x5cbabb,_0x42ed59){return function(_0x5e0165){if(_0x5e0165){return _0x5e0165[_0x90f5('0x24')]()[_0x90f5('0x23')](function(){var _0x570494=_0x5e0165['get']({'plain':!![]});var _0x3fa336=_0x90f5('0x25');return db[_0x90f5('0x26')][_0x90f5('0x24')]({'where':{'type':_0x3fa336,'resourceId':_0x570494['id']}})[_0x90f5('0x23')](function(){return _0x5e0165;});})[_0x90f5('0x23')](function(){_0x5cbabb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x307816,_0x169ffb){return function(_0x36bd0e){if(!_0x36bd0e){_0x307816['sendStatus'](0x194);}return _0x36bd0e;};}function handleError(_0x583b7f,_0x7dab61){_0x7dab61=_0x7dab61||0x1f4;return function(_0x546430){logger[_0x90f5('0x27')](_0x546430[_0x90f5('0x28')]);if(_0x546430[_0x90f5('0x29')]){delete _0x546430[_0x90f5('0x29')];}_0x583b7f[_0x90f5('0x19')](_0x7dab61)['send'](_0x546430);};}exports[_0x90f5('0x2a')]=function(_0x452e4a,_0x13c9b1){var _0x335496={},_0x957dc3={},_0x3b6ca8={'count':0x0,'rows':[]};var _0xb7497b=_[_0x90f5('0x2b')](db['JscriptyProject'][_0x90f5('0x2c')],function(_0x48b45b){return{'name':_0x48b45b[_0x90f5('0x2d')],'type':_0x48b45b[_0x90f5('0x2e')][_0x90f5('0x2f')]};});_0x957dc3['model']=_['map'](_0xb7497b,_0x90f5('0x29'));_0x957dc3['query']=_[_0x90f5('0x30')](_0x452e4a[_0x90f5('0x31')]);_0x957dc3[_0x90f5('0x32')]=_[_0x90f5('0x33')](_0x957dc3[_0x90f5('0x34')],_0x957dc3['query']);_0x335496[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x957dc3[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x452e4a[_0x90f5('0x31')][_0x90f5('0x36')]));_0x335496[_0x90f5('0x35')]=_0x335496[_0x90f5('0x35')][_0x90f5('0x37')]?_0x335496[_0x90f5('0x35')]:_0x957dc3['model'];if(!_0x452e4a[_0x90f5('0x31')]['hasOwnProperty'](_0x90f5('0x38'))){_0x335496[_0x90f5('0x1e')]=qs[_0x90f5('0x1e')](_0x452e4a[_0x90f5('0x31')][_0x90f5('0x1e')]);_0x335496[_0x90f5('0x1d')]=qs[_0x90f5('0x1d')](_0x452e4a[_0x90f5('0x31')]['offset']);}_0x335496[_0x90f5('0x39')]=qs['sort'](_0x452e4a[_0x90f5('0x31')]['sort']);_0x335496['where']=qs['filters'](_['pick'](_0x452e4a['query'],_0x957dc3[_0x90f5('0x32')]));if(_0x452e4a['query'][_0x90f5('0x3a')]){_0x335496['where']=_[_0x90f5('0x3b')](_0x335496[_0x90f5('0x3c')],{'$or':_['map'](_0xb7497b,function(_0x4e9c32){if(_0x4e9c32[_0x90f5('0x2e')]!==_0x90f5('0x3d')){var _0x298380={};_0x298380[_0x4e9c32[_0x90f5('0x29')]]={'$like':'%'+_0x452e4a['query'][_0x90f5('0x3a')]+'%'};return _0x298380;}})});}_0x335496=_[_0x90f5('0x3b')]({},_0x335496,_0x452e4a['options']);var _0x138aff={'where':_0x335496[_0x90f5('0x3c')]};return db[_0x90f5('0x3e')][_0x90f5('0x1c')](_0x138aff)[_0x90f5('0x23')](function(_0x2226a6){_0x3b6ca8['count']=_0x2226a6;if(_0x452e4a[_0x90f5('0x31')]['includeAll']){_0x335496['include']=[{'all':!![]}];}return db[_0x90f5('0x3e')][_0x90f5('0x3f')](_0x335496);})[_0x90f5('0x23')](function(_0x521f24){_0x3b6ca8[_0x90f5('0x40')]=_0x521f24;return _0x3b6ca8;})[_0x90f5('0x23')](respondWithFilteredResult(_0x13c9b1,_0x335496))[_0x90f5('0x41')](handleError(_0x13c9b1,null));};exports[_0x90f5('0x42')]=function(_0x5325d0,_0x38dffb){var _0x1b6032={'raw':![],'where':{'id':_0x5325d0[_0x90f5('0x43')]['id']}},_0x413d40={};_0x413d40[_0x90f5('0x34')]=_[_0x90f5('0x30')](db[_0x90f5('0x3e')][_0x90f5('0x2c')]);_0x413d40[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x5325d0[_0x90f5('0x31')]);_0x413d40['filters']=_['intersection'](_0x413d40['model'],_0x413d40[_0x90f5('0x31')]);_0x1b6032[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x413d40[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x5325d0[_0x90f5('0x31')][_0x90f5('0x36')]));_0x1b6032[_0x90f5('0x35')]=_0x1b6032[_0x90f5('0x35')]['length']?_0x1b6032[_0x90f5('0x35')]:_0x413d40[_0x90f5('0x34')];if(_0x5325d0[_0x90f5('0x31')][_0x90f5('0x44')]){_0x1b6032[_0x90f5('0x45')]=[{'all':!![]}];}_0x1b6032=_['merge']({},_0x1b6032,_0x5325d0[_0x90f5('0x46')]);return db[_0x90f5('0x3e')]['find'](_0x1b6032)[_0x90f5('0x23')](handleEntityNotFound(_0x38dffb,null))[_0x90f5('0x23')](respondWithResult(_0x38dffb,null))[_0x90f5('0x41')](handleError(_0x38dffb,null));};exports[_0x90f5('0x47')]=function(_0x72099f,_0x299533){return db[_0x90f5('0x3e')][_0x90f5('0x47')](_0x72099f[_0x90f5('0x48')],{})[_0x90f5('0x23')](function(_0x5417e9){var _0x1e3362=_0x72099f[_0x90f5('0x49')][_0x90f5('0x4a')]({'plain':!![]});if(!_0x1e3362)throw new Error(_0x90f5('0x4b'));if(_0x1e3362[_0x90f5('0x4c')]===_0x90f5('0x49')){var _0x11f71e=_0x5417e9[_0x90f5('0x4a')]({'plain':!![]});var _0x142a62='Projects';return db[_0x90f5('0x4d')][_0x90f5('0x4e')]({'where':{'name':_0x142a62,'userProfileId':_0x1e3362[_0x90f5('0x4f')]},'raw':!![]})[_0x90f5('0x23')](function(_0x29daa3){if(_0x29daa3&&_0x29daa3[_0x90f5('0x50')]===0x0){return db[_0x90f5('0x26')][_0x90f5('0x47')]({'name':_0x11f71e[_0x90f5('0x29')],'resourceId':_0x11f71e['id'],'type':_0x29daa3[_0x90f5('0x29')],'sectionId':_0x29daa3['id']},{})['then'](function(){return _0x5417e9;});}else{return _0x5417e9;}})['catch'](function(_0xe4ddc9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe4ddc9);throw _0xe4ddc9;});}return _0x5417e9;})[_0x90f5('0x23')](respondWithResult(_0x299533,0xc9))['catch'](handleError(_0x299533,null));};exports[_0x90f5('0x51')]=function(_0x2d1484,_0x82fe1d){var _0x39fa3c={'where':{'id':_0x2d1484[_0x90f5('0x43')]['id']}},_0x15f38b={};_0x15f38b[_0x90f5('0x34')]=_[_0x90f5('0x30')](db[_0x90f5('0x3e')][_0x90f5('0x2c')]);_0x39fa3c[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x15f38b[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x2d1484[_0x90f5('0x31')][_0x90f5('0x36')]));_0x39fa3c['attributes']=_0x39fa3c['attributes'][_0x90f5('0x37')]?_0x39fa3c['attributes']:_0x15f38b['model'];if(_0x2d1484[_0x90f5('0x31')][_0x90f5('0x44')]){_0x39fa3c[_0x90f5('0x45')]=[{'all':!![]}];}_0x39fa3c=_[_0x90f5('0x3b')]({},_0x39fa3c,_0x2d1484[_0x90f5('0x46')]);return db[_0x90f5('0x3e')]['find'](_0x39fa3c)[_0x90f5('0x23')](handleEntityNotFound(_0x82fe1d,null))[_0x90f5('0x23')](function(_0x35d2e0){if(_0x35d2e0){var _0x49f95c=_0x35d2e0['get']({'plain':!![]});_0x49f95c=qs[_0x90f5('0x52')](_0x49f95c,['id',_0x90f5('0x53'),_0x90f5('0x54')]);_0x2d1484[_0x90f5('0x48')]=_[_0x90f5('0x52')](_0x2d1484['body'],['id',_0x90f5('0x53'),_0x90f5('0x54')]);return db[_0x90f5('0x3e')][_0x90f5('0x47')](_[_0x90f5('0x3b')](_0x49f95c,_0x2d1484[_0x90f5('0x48')]),{'include':_0x2d1484[_0x90f5('0x31')][_0x90f5('0x44')]?[{'all':!![]}]:undefined})[_0x90f5('0x23')](function(_0x644df5){var _0x503d8d=_0x2d1484[_0x90f5('0x49')]['get']({'plain':!![]});if(!_0x503d8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x503d8d[_0x90f5('0x4c')]==='user'){var _0x531d93=_0x644df5[_0x90f5('0x4a')]({'plain':!![]});var _0x2f2fff=_0x90f5('0x25');return db['UserProfileSection'][_0x90f5('0x4e')]({'where':{'name':_0x2f2fff,'userProfileId':_0x503d8d[_0x90f5('0x4f')]},'raw':!![]})[_0x90f5('0x23')](function(_0x35786a){if(_0x35786a&&_0x35786a['autoAssociation']===0x0){return db['UserProfileResource'][_0x90f5('0x47')]({'name':_0x531d93['name'],'resourceId':_0x531d93['id'],'type':_0x35786a[_0x90f5('0x29')],'sectionId':_0x35786a['id']},{})[_0x90f5('0x23')](function(){return _0x644df5;});}else{return _0x644df5;}})[_0x90f5('0x41')](function(_0x1729b4){logger[_0x90f5('0x27')](_0x90f5('0x55'),_0x1729b4);throw _0x1729b4;});}return _0x644df5;});}})[_0x90f5('0x23')](respondWithResult(_0x82fe1d,0xc9))[_0x90f5('0x41')](handleError(_0x82fe1d,null));};exports['update']=function(_0x1fa0a4,_0x3a3ef9){if(_0x1fa0a4[_0x90f5('0x48')]['id']){delete _0x1fa0a4[_0x90f5('0x48')]['id'];}return db['JscriptyProject'][_0x90f5('0x4e')]({'where':{'id':_0x1fa0a4[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x3a3ef9,null))[_0x90f5('0x23')](saveUpdates(_0x1fa0a4['body'],null))[_0x90f5('0x23')](respondWithResult(_0x3a3ef9,null))[_0x90f5('0x41')](handleError(_0x3a3ef9,null));};exports['destroy']=function(_0x1ef9f2,_0x230088){return db[_0x90f5('0x3e')][_0x90f5('0x4e')]({'where':{'id':_0x1ef9f2['params']['id']}})['then'](handleEntityNotFound(_0x230088,null))['then'](removeEntity(_0x230088,null))['catch'](handleError(_0x230088,null));};exports[_0x90f5('0x56')]=function(_0x299304,_0x6c47ea,_0x3ac859){var _0x11fb76={'raw':!![],'where':{}};var _0x1b7176={};var _0x37d906={'count':0x0,'rows':[]};return db[_0x90f5('0x3e')][_0x90f5('0x57')]({'where':{'id':_0x299304[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x6c47ea,null))[_0x90f5('0x23')](function(_0x40589a){if(_0x40589a){_0x1b7176['model']=_[_0x90f5('0x30')](db[_0x90f5('0x58')][_0x90f5('0x2c')]);_0x1b7176[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x299304['query']);_0x1b7176[_0x90f5('0x32')]=_['intersection'](_0x1b7176[_0x90f5('0x34')],_0x1b7176['query']);_0x11fb76[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x1b7176['model'],qs[_0x90f5('0x36')](_0x299304[_0x90f5('0x31')][_0x90f5('0x36')]));_0x11fb76['attributes']=_0x11fb76[_0x90f5('0x35')]['length']?_0x11fb76[_0x90f5('0x35')]:_0x1b7176[_0x90f5('0x34')];if(!_0x299304[_0x90f5('0x31')][_0x90f5('0x59')](_0x90f5('0x38'))){_0x11fb76[_0x90f5('0x1e')]=qs['limit'](_0x299304[_0x90f5('0x31')]['limit']);_0x11fb76['offset']=qs[_0x90f5('0x1d')](_0x299304[_0x90f5('0x31')][_0x90f5('0x1d')]);}_0x11fb76[_0x90f5('0x39')]=qs[_0x90f5('0x5a')](_0x299304[_0x90f5('0x31')][_0x90f5('0x5a')]);_0x11fb76['where']=qs[_0x90f5('0x32')](_[_0x90f5('0x5b')](_0x299304[_0x90f5('0x31')],_0x1b7176[_0x90f5('0x32')]));_0x11fb76['where']['ProjectId']=_0x40589a['id'];if(_0x299304[_0x90f5('0x31')][_0x90f5('0x3a')]){_0x11fb76[_0x90f5('0x3c')]=_[_0x90f5('0x3b')](_0x11fb76['where'],{'$or':_['map'](_0x11fb76[_0x90f5('0x35')],function(_0x9714c4){var _0x260afd={};_0x260afd[_0x9714c4]={'$like':'%'+_0x299304[_0x90f5('0x31')][_0x90f5('0x3a')]+'%'};return _0x260afd;})});}_0x11fb76=_[_0x90f5('0x3b')]({},_0x11fb76,_0x299304['options']);return db['JscriptySessionReport'][_0x90f5('0x1c')]({'where':_0x11fb76[_0x90f5('0x3c')]})[_0x90f5('0x23')](function(_0x4b04a1){_0x37d906['count']=_0x4b04a1;if(_0x299304[_0x90f5('0x31')]['includeAll']){_0x11fb76[_0x90f5('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x90f5('0x3f')](_0x11fb76);})[_0x90f5('0x23')](function(_0x597bb9){_0x37d906[_0x90f5('0x40')]=_0x597bb9;return _0x37d906;});}})[_0x90f5('0x23')](respondWithFilteredResult(_0x6c47ea,_0x11fb76))[_0x90f5('0x41')](handleError(_0x6c47ea,null));};exports[_0x90f5('0x5c')]=function(_0x5b0fef,_0x16b966,_0x5d72f3){var _0x12e37c={'raw':!![],'where':{}};var _0x2d00be={};var _0x2f1119={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x90f5('0x57')]({'where':{'id':_0x5b0fef[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x16b966,null))[_0x90f5('0x23')](function(_0x2a1492){if(_0x2a1492){_0x2d00be[_0x90f5('0x34')]=_[_0x90f5('0x30')](db['JscriptyAnswerReport'][_0x90f5('0x2c')]);_0x2d00be[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x5b0fef['query']);_0x2d00be[_0x90f5('0x32')]=_[_0x90f5('0x33')](_0x2d00be[_0x90f5('0x34')],_0x2d00be[_0x90f5('0x31')]);_0x12e37c[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x2d00be[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x36')]));_0x12e37c['attributes']=_0x12e37c[_0x90f5('0x35')][_0x90f5('0x37')]?_0x12e37c[_0x90f5('0x35')]:_0x2d00be[_0x90f5('0x34')];if(!_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x59')](_0x90f5('0x38'))){_0x12e37c[_0x90f5('0x1e')]=qs[_0x90f5('0x1e')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x1e')]);_0x12e37c[_0x90f5('0x1d')]=qs[_0x90f5('0x1d')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x1d')]);}_0x12e37c[_0x90f5('0x39')]=qs[_0x90f5('0x5a')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x5a')]);_0x12e37c[_0x90f5('0x3c')]=qs[_0x90f5('0x32')](_[_0x90f5('0x5b')](_0x5b0fef[_0x90f5('0x31')],_0x2d00be['filters']));_0x12e37c[_0x90f5('0x3c')]['ProjectId']=_0x2a1492['id'];if(_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x3a')]){_0x12e37c['where']=_[_0x90f5('0x3b')](_0x12e37c[_0x90f5('0x3c')],{'$or':_[_0x90f5('0x2b')](_0x12e37c['attributes'],function(_0x3ea600){var _0x5a6017={};_0x5a6017[_0x3ea600]={'$like':'%'+_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x3a')]+'%'};return _0x5a6017;})});}_0x12e37c=_[_0x90f5('0x3b')]({},_0x12e37c,_0x5b0fef[_0x90f5('0x46')]);return db[_0x90f5('0x5d')]['count']({'where':_0x12e37c['where']})[_0x90f5('0x23')](function(_0x260037){_0x2f1119[_0x90f5('0x1c')]=_0x260037;if(_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x44')]){_0x12e37c[_0x90f5('0x45')]=[{'all':!![]}];}return db[_0x90f5('0x5d')][_0x90f5('0x3f')](_0x12e37c);})[_0x90f5('0x23')](function(_0x20184d){_0x2f1119[_0x90f5('0x40')]=_0x20184d;return _0x2f1119;});}})[_0x90f5('0x23')](respondWithFilteredResult(_0x16b966,_0x12e37c))[_0x90f5('0x41')](handleError(_0x16b966,null));};function char(_0x2d49b9){return _0x90f5('0x5e')===typeof _0x2d49b9?String['fromCharCode'][_0x90f5('0x20')](null,arguments):_0x2d49b9;}function needsEncapsulation(_0x19f633){return!!_0x19f633&&(_0x19f633[_0x90f5('0x5f')]()[_0x90f5('0x60')](char(0xd))>=0x0||_0x19f633['toString']()[_0x90f5('0x60')](char(0xa))>=0x0||_0x19f633[_0x90f5('0x5f')]()[_0x90f5('0x60')](char(0x2c))>=0x0||_0x19f633['toString']()[_0x90f5('0x60')](char(0x22))>=0x0);}function encapsulate(_0x34497e){var _0x24c9d8=char(0x22),_0x3dd947='\x5c'+char(0x22),_0x14c2f3=_0x34497e[_0x90f5('0x5f')]()['replace'](new RegExp(_0x24c9d8,'g'),_0x3dd947);return _0x24c9d8+_0x14c2f3+_0x24c9d8;}exports[_0x90f5('0x61')]=function(_0x5c47c5,_0x6eeea4,_0x3df13f){var _0x12a4e,_0x1ee8ee;var _0x1a6659={'where':{'ProjectId':_0x5c47c5[_0x90f5('0x43')]['id']}};if(_0x5c47c5[_0x90f5('0x31')][_0x90f5('0x62')]){_0x1a6659[_0x90f5('0x3c')][_0x90f5('0x63')]=JSON[_0x90f5('0x64')](_0x5c47c5[_0x90f5('0x31')][_0x90f5('0x62')]);}return db[_0x90f5('0x58')][_0x90f5('0x3f')](_0x1a6659)[_0x90f5('0x23')](handleEntityNotFound(_0x6eeea4,null))[_0x90f5('0x23')](function(_0x1f1721){if(_0x1f1721){_0x12a4e=_0x1f1721;return db['JscriptyQuestionReport'][_0x90f5('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x12a4e,'id')},'ProjectId':_0x5c47c5['params']['id']},'order':'-createdAt'});}})[_0x90f5('0x23')](handleEntityNotFound(_0x6eeea4,null))[_0x90f5('0x23')](function(_0xd87b66){if(_0xd87b66){_0x1ee8ee=_0xd87b66;var _0x4d95ac={};for(var _0x1bd2ae=0x0,_0x54f43b=_0x1ee8ee['length'];_0x1bd2ae<_0x54f43b;_0x1bd2ae++){if(!_0x4d95ac[_0x90f5('0x59')](_0x1ee8ee[_0x1bd2ae][_0x90f5('0x65')])){_0x4d95ac[_0x1ee8ee[_0x1bd2ae]['questionId']]=needsEncapsulation(_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')])?encapsulate(_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')]):_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')];}}var _0x23bfbc=[],_0x125bb7={};for(var _0x4b4331=0x0,_0x2fd380=_0x12a4e[_0x90f5('0x37')];_0x4b4331<_0x2fd380;_0x4b4331++){_0x125bb7={'ProjectId':_0x5c47c5[_0x90f5('0x43')]['id'],'SessionId':_0x12a4e[_0x4b4331]['id'],'StartTime':moment(_0x12a4e[_0x4b4331][_0x90f5('0x63')])[_0x90f5('0x67')](_0x90f5('0x68'))};for(var _0x3f554e=0x0,_0x5eb593=_0x1ee8ee[_0x90f5('0x37')];_0x3f554e<_0x5eb593;_0x3f554e++){if(_0x1ee8ee[_0x3f554e]['SessionId']==_0x12a4e[_0x4b4331]['id']&&_0x4d95ac[_0x90f5('0x59')](_0x1ee8ee[_0x3f554e][_0x90f5('0x65')])){_0x125bb7[_0x4d95ac[_0x1ee8ee[_0x3f554e][_0x90f5('0x65')]]]=_0x1ee8ee[_0x3f554e]['answer'];}}for(var _0x22af19 in _0x4d95ac){if(!_0x125bb7[_0x90f5('0x59')](_0x4d95ac[_0x22af19])){_0x125bb7[_0x4d95ac[_0x22af19]]=null;}}_0x23bfbc[_0x90f5('0x69')](_0x125bb7);}return _0x23bfbc;}})[_0x90f5('0x23')](function(_0x23a048){if(!_[_0x90f5('0x6a')](_0x23a048)){var _0x28c4cd=toCsv(_0x23a048);var _0x5b1c66=Date[_0x90f5('0x6b')]();fs['writeFileSync'](util[_0x90f5('0x67')](_0x90f5('0x6c'),_0x5c47c5['params']['id'],_0x5b1c66),_0x28c4cd);_0x6eeea4[_0x90f5('0x6d')](_0x90f5('0x6e'),'attachment;\x20filename='+util['format'](_0x90f5('0x6f'),_0x5c47c5[_0x90f5('0x43')]['id'],_0x5b1c66));_0x6eeea4['setHeader'](_0x90f5('0x70'),_0x90f5('0x71'));return _0x6eeea4[_0x90f5('0x72')](util[_0x90f5('0x67')](_0x90f5('0x6c'),_0x5c47c5['params']['id'],_0x5b1c66));}else{return _0x6eeea4[_0x90f5('0x73')](0xcc);}})[_0x90f5('0x41')](handleError(_0x6eeea4,null));};
\ No newline at end of file
+var _0x93ab=['indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','count','offset','set','Content-Range','reject','save','then','destroy','Projects','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getSessions','length','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','nolimit','number','apply','toString'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x93ab,0x1e0));var _0xb93a=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x93ab[_0x187718];return _0x29ddf4;};'use strict';var pdf=require(_0xb93a('0x0'));var emlformat=require(_0xb93a('0x1'));var rimraf=require(_0xb93a('0x2'));var zipdir=require(_0xb93a('0x3'));var jsonpatch=require(_0xb93a('0x4'));var rp=require(_0xb93a('0x5'));var moment=require(_0xb93a('0x6'));var BPromise=require(_0xb93a('0x7'));var Mustache=require(_0xb93a('0x8'));var util=require(_0xb93a('0x9'));var path=require(_0xb93a('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb93a('0xb'));var fs=require('fs');var _=require(_0xb93a('0xc'));var squel=require(_0xb93a('0xd'));var crypto=require(_0xb93a('0xe'));var jsforce=require(_0xb93a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb93a('0x10'));var querystring=require(_0xb93a('0x11'));var Papa=require(_0xb93a('0x12'));var Redis=require(_0xb93a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb93a('0x14'));var hardwareService=require(_0xb93a('0x15'));var logger=require('../../config/logger')(_0xb93a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b09d,_0x4fbaae){_0x4fbaae=_0x4fbaae||0xcc;return function(_0x58c958){if(_0x58c958){return _0x23b09d[_0xb93a('0x17')](_0x4fbaae);}return _0x23b09d[_0xb93a('0x18')](_0x4fbaae)['end']();};}function respondWithResult(_0x51f7cc,_0x4346cf){_0x4346cf=_0x4346cf||0xc8;return function(_0x141598){if(_0x141598){return _0x51f7cc['status'](_0x4346cf)[_0xb93a('0x19')](_0x141598);}};}function respondWithFilteredResult(_0x65de63,_0x31579f){return function(_0x23abe9){if(_0x23abe9){var _0x282df5=_0x23abe9[_0xb93a('0x1a')],_0x450ae1=_0x31579f['offset'],_0x20237f=_0x31579f[_0xb93a('0x1b')]+_0x31579f['limit'],_0x507a00;if(_0x20237f>=_0x282df5){_0x20237f=_0x282df5;_0x507a00=0xc8;}else{_0x507a00=0xce;}_0x65de63[_0xb93a('0x18')](_0x507a00);return _0x65de63[_0xb93a('0x1c')](_0xb93a('0x1d'),_0x450ae1+'-'+_0x20237f+'/'+_0x282df5)[_0xb93a('0x19')](_0x23abe9);}return null;};}function patchUpdates(_0x32b7e6){return function(_0x147db7){try{jsonpatch['apply'](_0x147db7,_0x32b7e6,!![]);}catch(_0x24028a){return BPromise[_0xb93a('0x1e')](_0x24028a);}return _0x147db7[_0xb93a('0x1f')]();};}function saveUpdates(_0x2370da,_0x5e10ed){return function(_0x348efc){if(_0x348efc){return _0x348efc['update'](_0x2370da)[_0xb93a('0x20')](function(_0x19280f){return _0x19280f;});}return null;};}function removeEntity(_0x2fba62,_0x49541a){return function(_0x2e554e){if(_0x2e554e){return _0x2e554e[_0xb93a('0x21')]()[_0xb93a('0x20')](function(){var _0xe9cece=_0x2e554e['get']({'plain':!![]});var _0x36d035=_0xb93a('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x36d035,'resourceId':_0xe9cece['id']}})[_0xb93a('0x20')](function(){return _0x2e554e;});})[_0xb93a('0x20')](function(){_0x2fba62[_0xb93a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf02cb7,_0x24604c){return function(_0x5a3cb6){if(!_0x5a3cb6){_0xf02cb7['sendStatus'](0x194);}return _0x5a3cb6;};}function handleError(_0x13873f,_0xf990d5){_0xf990d5=_0xf990d5||0x1f4;return function(_0x5bbfad){logger[_0xb93a('0x23')](_0x5bbfad['stack']);if(_0x5bbfad[_0xb93a('0x24')]){delete _0x5bbfad[_0xb93a('0x24')];}_0x13873f[_0xb93a('0x18')](_0xf990d5)[_0xb93a('0x25')](_0x5bbfad);};}exports[_0xb93a('0x26')]=function(_0x226bde,_0x3410ee){var _0x310b17={},_0xbb977d={},_0x133874={'count':0x0,'rows':[]};var _0x5275ae=_[_0xb93a('0x27')](db[_0xb93a('0x28')][_0xb93a('0x29')],function(_0x4fd571){return{'name':_0x4fd571[_0xb93a('0x2a')],'type':_0x4fd571['type'][_0xb93a('0x2b')]};});_0xbb977d[_0xb93a('0x2c')]=_[_0xb93a('0x27')](_0x5275ae,_0xb93a('0x24'));_0xbb977d[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x226bde[_0xb93a('0x2d')]);_0xbb977d[_0xb93a('0x2f')]=_['intersection'](_0xbb977d['model'],_0xbb977d[_0xb93a('0x2d')]);_0x310b17[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0xbb977d[_0xb93a('0x2c')],qs['fields'](_0x226bde['query'][_0xb93a('0x32')]));_0x310b17[_0xb93a('0x30')]=_0x310b17[_0xb93a('0x30')]['length']?_0x310b17[_0xb93a('0x30')]:_0xbb977d[_0xb93a('0x2c')];if(!_0x226bde[_0xb93a('0x2d')]['hasOwnProperty']('nolimit')){_0x310b17[_0xb93a('0x33')]=qs['limit'](_0x226bde['query']['limit']);_0x310b17[_0xb93a('0x1b')]=qs[_0xb93a('0x1b')](_0x226bde[_0xb93a('0x2d')]['offset']);}_0x310b17[_0xb93a('0x34')]=qs[_0xb93a('0x35')](_0x226bde[_0xb93a('0x2d')]['sort']);_0x310b17['where']=qs[_0xb93a('0x2f')](_[_0xb93a('0x36')](_0x226bde['query'],_0xbb977d['filters']));if(_0x226bde[_0xb93a('0x2d')][_0xb93a('0x37')]){_0x310b17[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0x310b17[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0x5275ae,function(_0x33716e){if(_0x33716e['type']!==_0xb93a('0x3a')){var _0x39190d={};_0x39190d[_0x33716e[_0xb93a('0x24')]]={'$like':'%'+_0x226bde[_0xb93a('0x2d')]['filter']+'%'};return _0x39190d;}})});}_0x310b17=_[_0xb93a('0x39')]({},_0x310b17,_0x226bde[_0xb93a('0x3b')]);var _0x1f4488={'where':_0x310b17['where']};return db[_0xb93a('0x28')]['count'](_0x1f4488)[_0xb93a('0x20')](function(_0x565f8b){_0x133874['count']=_0x565f8b;if(_0x226bde[_0xb93a('0x2d')]['includeAll']){_0x310b17['include']=[{'all':!![]}];}return db[_0xb93a('0x28')][_0xb93a('0x3c')](_0x310b17);})[_0xb93a('0x20')](function(_0x32fdeb){_0x133874[_0xb93a('0x3d')]=_0x32fdeb;return _0x133874;})[_0xb93a('0x20')](respondWithFilteredResult(_0x3410ee,_0x310b17))[_0xb93a('0x3e')](handleError(_0x3410ee,null));};exports[_0xb93a('0x3f')]=function(_0x562041,_0xa011db){var _0x922c68={'raw':![],'where':{'id':_0x562041[_0xb93a('0x40')]['id']}},_0x252f88={};_0x252f88['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x28')][_0xb93a('0x29')]);_0x252f88[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x562041['query']);_0x252f88[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0x252f88[_0xb93a('0x2c')],_0x252f88[_0xb93a('0x2d')]);_0x922c68[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0x252f88[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x562041[_0xb93a('0x2d')][_0xb93a('0x32')]));_0x922c68[_0xb93a('0x30')]=_0x922c68[_0xb93a('0x30')]['length']?_0x922c68['attributes']:_0x252f88['model'];if(_0x562041[_0xb93a('0x2d')][_0xb93a('0x41')]){_0x922c68[_0xb93a('0x42')]=[{'all':!![]}];}_0x922c68=_[_0xb93a('0x39')]({},_0x922c68,_0x562041[_0xb93a('0x3b')]);return db[_0xb93a('0x28')][_0xb93a('0x43')](_0x922c68)[_0xb93a('0x20')](handleEntityNotFound(_0xa011db,null))[_0xb93a('0x20')](respondWithResult(_0xa011db,null))['catch'](handleError(_0xa011db,null));};exports[_0xb93a('0x44')]=function(_0xcd5ca3,_0x3eedfb){return db['JscriptyProject']['create'](_0xcd5ca3[_0xb93a('0x45')],{})[_0xb93a('0x20')](function(_0x47a06b){var _0x1b8290=_0xcd5ca3[_0xb93a('0x46')][_0xb93a('0x47')]({'plain':!![]});if(!_0x1b8290)throw new Error(_0xb93a('0x48'));if(_0x1b8290[_0xb93a('0x49')]===_0xb93a('0x46')){var _0xed8709=_0x47a06b[_0xb93a('0x47')]({'plain':!![]});var _0x425cc6=_0xb93a('0x22');return db[_0xb93a('0x4a')][_0xb93a('0x43')]({'where':{'name':_0x425cc6,'userProfileId':_0x1b8290[_0xb93a('0x4b')]},'raw':!![]})['then'](function(_0x3275c3){if(_0x3275c3&&_0x3275c3[_0xb93a('0x4c')]===0x0){return db[_0xb93a('0x4d')][_0xb93a('0x44')]({'name':_0xed8709[_0xb93a('0x24')],'resourceId':_0xed8709['id'],'type':_0x3275c3[_0xb93a('0x24')],'sectionId':_0x3275c3['id']},{})[_0xb93a('0x20')](function(){return _0x47a06b;});}else{return _0x47a06b;}})['catch'](function(_0x4f09aa){logger[_0xb93a('0x23')](_0xb93a('0x4e'),_0x4f09aa);throw _0x4f09aa;});}return _0x47a06b;})[_0xb93a('0x20')](respondWithResult(_0x3eedfb,0xc9))[_0xb93a('0x3e')](handleError(_0x3eedfb,null));};exports[_0xb93a('0x4f')]=function(_0x18086c,_0x32308d){var _0x3e21a2={'where':{'id':_0x18086c[_0xb93a('0x40')]['id']}},_0x172a5c={};_0x172a5c['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x28')][_0xb93a('0x29')]);_0x3e21a2[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0x172a5c[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x18086c['query'][_0xb93a('0x32')]));_0x3e21a2['attributes']=_0x3e21a2[_0xb93a('0x30')]['length']?_0x3e21a2[_0xb93a('0x30')]:_0x172a5c[_0xb93a('0x2c')];if(_0x18086c[_0xb93a('0x2d')]['includeAll']){_0x3e21a2[_0xb93a('0x42')]=[{'all':!![]}];}_0x3e21a2=_[_0xb93a('0x39')]({},_0x3e21a2,_0x18086c['options']);return db[_0xb93a('0x28')][_0xb93a('0x43')](_0x3e21a2)[_0xb93a('0x20')](handleEntityNotFound(_0x32308d,null))[_0xb93a('0x20')](function(_0x2679bb){if(_0x2679bb){var _0x4f07e9=_0x2679bb['get']({'plain':!![]});_0x4f07e9=qs[_0xb93a('0x50')](_0x4f07e9,['id','createdAt',_0xb93a('0x51')]);_0x18086c[_0xb93a('0x45')]=_[_0xb93a('0x50')](_0x18086c[_0xb93a('0x45')],['id',_0xb93a('0x52'),_0xb93a('0x51')]);return db[_0xb93a('0x28')][_0xb93a('0x44')](_['merge'](_0x4f07e9,_0x18086c['body']),{'include':_0x18086c[_0xb93a('0x2d')][_0xb93a('0x41')]?[{'all':!![]}]:undefined})[_0xb93a('0x20')](function(_0x3174ed){var _0x153e7c=_0x18086c[_0xb93a('0x46')][_0xb93a('0x47')]({'plain':!![]});if(!_0x153e7c)throw new Error(_0xb93a('0x48'));if(_0x153e7c[_0xb93a('0x49')]===_0xb93a('0x46')){var _0x4c5758=_0x3174ed[_0xb93a('0x47')]({'plain':!![]});var _0xdb60ed=_0xb93a('0x22');return db['UserProfileSection']['find']({'where':{'name':_0xdb60ed,'userProfileId':_0x153e7c[_0xb93a('0x4b')]},'raw':!![]})[_0xb93a('0x20')](function(_0x18dff2){if(_0x18dff2&&_0x18dff2['autoAssociation']===0x0){return db['UserProfileResource'][_0xb93a('0x44')]({'name':_0x4c5758[_0xb93a('0x24')],'resourceId':_0x4c5758['id'],'type':_0x18dff2[_0xb93a('0x24')],'sectionId':_0x18dff2['id']},{})[_0xb93a('0x20')](function(){return _0x3174ed;});}else{return _0x3174ed;}})[_0xb93a('0x3e')](function(_0xebedf8){logger[_0xb93a('0x23')](_0xb93a('0x4e'),_0xebedf8);throw _0xebedf8;});}return _0x3174ed;});}})['then'](respondWithResult(_0x32308d,0xc9))[_0xb93a('0x3e')](handleError(_0x32308d,null));};exports['update']=function(_0x4b72ad,_0x5d19f6){if(_0x4b72ad['body']['id']){delete _0x4b72ad[_0xb93a('0x45')]['id'];}return db[_0xb93a('0x28')][_0xb93a('0x43')]({'where':{'id':_0x4b72ad['params']['id']}})[_0xb93a('0x20')](handleEntityNotFound(_0x5d19f6,null))[_0xb93a('0x20')](saveUpdates(_0x4b72ad[_0xb93a('0x45')],null))['then'](respondWithResult(_0x5d19f6,null))[_0xb93a('0x3e')](handleError(_0x5d19f6,null));};exports['destroy']=function(_0x1b540d,_0x51032e){return db[_0xb93a('0x28')][_0xb93a('0x43')]({'where':{'id':_0x1b540d[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x51032e,null))[_0xb93a('0x20')](removeEntity(_0x51032e,null))[_0xb93a('0x3e')](handleError(_0x51032e,null));};exports[_0xb93a('0x53')]=function(_0x42bf72,_0x172c83,_0x1c5bf0){var _0x106443={'raw':!![],'where':{}};var _0xd0250b={};var _0x175ea6={'count':0x0,'rows':[]};return db[_0xb93a('0x28')]['findOne']({'where':{'id':_0x42bf72[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x172c83,null))['then'](function(_0x2d8e2a){if(_0x2d8e2a){_0xd0250b[_0xb93a('0x2c')]=_[_0xb93a('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0xd0250b[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x42bf72['query']);_0xd0250b[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0xd0250b['model'],_0xd0250b['query']);_0x106443[_0xb93a('0x30')]=_[_0xb93a('0x31')](_0xd0250b[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x42bf72[_0xb93a('0x2d')]['fields']));_0x106443['attributes']=_0x106443[_0xb93a('0x30')][_0xb93a('0x54')]?_0x106443[_0xb93a('0x30')]:_0xd0250b['model'];if(!_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x55')]('nolimit')){_0x106443[_0xb93a('0x33')]=qs[_0xb93a('0x33')](_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x33')]);_0x106443[_0xb93a('0x1b')]=qs['offset'](_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x1b')]);}_0x106443[_0xb93a('0x34')]=qs['sort'](_0x42bf72[_0xb93a('0x2d')]['sort']);_0x106443[_0xb93a('0x38')]=qs['filters'](_[_0xb93a('0x36')](_0x42bf72[_0xb93a('0x2d')],_0xd0250b[_0xb93a('0x2f')]));_0x106443[_0xb93a('0x38')][_0xb93a('0x56')]=_0x2d8e2a['id'];if(_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x37')]){_0x106443[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0x106443[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0x106443['attributes'],function(_0x26c019){var _0x21e50a={};_0x21e50a[_0x26c019]={'$like':'%'+_0x42bf72['query']['filter']+'%'};return _0x21e50a;})});}_0x106443=_['merge']({},_0x106443,_0x42bf72[_0xb93a('0x3b')]);return db[_0xb93a('0x57')][_0xb93a('0x1a')]({'where':_0x106443[_0xb93a('0x38')]})[_0xb93a('0x20')](function(_0x59b28e){_0x175ea6['count']=_0x59b28e;if(_0x42bf72[_0xb93a('0x2d')][_0xb93a('0x41')]){_0x106443[_0xb93a('0x42')]=[{'all':!![]}];}return db[_0xb93a('0x57')][_0xb93a('0x3c')](_0x106443);})[_0xb93a('0x20')](function(_0x1e2a14){_0x175ea6[_0xb93a('0x3d')]=_0x1e2a14;return _0x175ea6;});}})[_0xb93a('0x20')](respondWithFilteredResult(_0x172c83,_0x106443))[_0xb93a('0x3e')](handleError(_0x172c83,null));};exports[_0xb93a('0x58')]=function(_0x42e305,_0x42e443,_0x56b1fe){var _0xfc85be={'raw':!![],'where':{}};var _0xcf6875={};var _0x4f4148={'count':0x0,'rows':[]};return db[_0xb93a('0x28')][_0xb93a('0x59')]({'where':{'id':_0x42e305[_0xb93a('0x40')]['id']}})['then'](handleEntityNotFound(_0x42e443,null))[_0xb93a('0x20')](function(_0x5ce2a1){if(_0x5ce2a1){_0xcf6875['model']=_[_0xb93a('0x2e')](db[_0xb93a('0x5a')]['rawAttributes']);_0xcf6875[_0xb93a('0x2d')]=_[_0xb93a('0x2e')](_0x42e305[_0xb93a('0x2d')]);_0xcf6875[_0xb93a('0x2f')]=_[_0xb93a('0x31')](_0xcf6875[_0xb93a('0x2c')],_0xcf6875['query']);_0xfc85be['attributes']=_['intersection'](_0xcf6875[_0xb93a('0x2c')],qs[_0xb93a('0x32')](_0x42e305['query'][_0xb93a('0x32')]));_0xfc85be['attributes']=_0xfc85be[_0xb93a('0x30')][_0xb93a('0x54')]?_0xfc85be[_0xb93a('0x30')]:_0xcf6875[_0xb93a('0x2c')];if(!_0x42e305[_0xb93a('0x2d')][_0xb93a('0x55')](_0xb93a('0x5b'))){_0xfc85be[_0xb93a('0x33')]=qs[_0xb93a('0x33')](_0x42e305['query'][_0xb93a('0x33')]);_0xfc85be[_0xb93a('0x1b')]=qs[_0xb93a('0x1b')](_0x42e305['query'][_0xb93a('0x1b')]);}_0xfc85be[_0xb93a('0x34')]=qs['sort'](_0x42e305[_0xb93a('0x2d')][_0xb93a('0x35')]);_0xfc85be[_0xb93a('0x38')]=qs[_0xb93a('0x2f')](_[_0xb93a('0x36')](_0x42e305[_0xb93a('0x2d')],_0xcf6875[_0xb93a('0x2f')]));_0xfc85be[_0xb93a('0x38')][_0xb93a('0x56')]=_0x5ce2a1['id'];if(_0x42e305['query'][_0xb93a('0x37')]){_0xfc85be[_0xb93a('0x38')]=_[_0xb93a('0x39')](_0xfc85be[_0xb93a('0x38')],{'$or':_[_0xb93a('0x27')](_0xfc85be[_0xb93a('0x30')],function(_0x84cd88){var _0x456cdc={};_0x456cdc[_0x84cd88]={'$like':'%'+_0x42e305['query'][_0xb93a('0x37')]+'%'};return _0x456cdc;})});}_0xfc85be=_[_0xb93a('0x39')]({},_0xfc85be,_0x42e305['options']);return db['JscriptyAnswerReport'][_0xb93a('0x1a')]({'where':_0xfc85be[_0xb93a('0x38')]})['then'](function(_0xfdaf38){_0x4f4148[_0xb93a('0x1a')]=_0xfdaf38;if(_0x42e305[_0xb93a('0x2d')][_0xb93a('0x41')]){_0xfc85be[_0xb93a('0x42')]=[{'all':!![]}];}return db[_0xb93a('0x5a')][_0xb93a('0x3c')](_0xfc85be);})[_0xb93a('0x20')](function(_0x592f03){_0x4f4148[_0xb93a('0x3d')]=_0x592f03;return _0x4f4148;});}})[_0xb93a('0x20')](respondWithFilteredResult(_0x42e443,_0xfc85be))[_0xb93a('0x3e')](handleError(_0x42e443,null));};function char(_0x37a2a2){return _0xb93a('0x5c')===typeof _0x37a2a2?String['fromCharCode'][_0xb93a('0x5d')](null,arguments):_0x37a2a2;}function needsEncapsulation(_0x763c3e){return!!_0x763c3e&&(_0x763c3e[_0xb93a('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x763c3e[_0xb93a('0x5e')]()[_0xb93a('0x5f')](char(0xa))>=0x0||_0x763c3e[_0xb93a('0x5e')]()[_0xb93a('0x5f')](char(0x2c))>=0x0||_0x763c3e['toString']()[_0xb93a('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x270c04){var _0x3217eb=char(0x22),_0x4af10a='\x5c'+char(0x22),_0x12239f=_0x270c04[_0xb93a('0x5e')]()[_0xb93a('0x60')](new RegExp(_0x3217eb,'g'),_0x4af10a);return _0x3217eb+_0x12239f+_0x3217eb;}exports[_0xb93a('0x61')]=function(_0x3a1202,_0x2c46b5,_0x252278){var _0x5097ca,_0x79796;var _0x106689={'where':{'ProjectId':_0x3a1202[_0xb93a('0x40')]['id']}};if(_0x3a1202['query'][_0xb93a('0x62')]){_0x106689[_0xb93a('0x38')]['starttime']=JSON['parse'](_0x3a1202[_0xb93a('0x2d')]['startTime']);}return db[_0xb93a('0x57')][_0xb93a('0x3c')](_0x106689)[_0xb93a('0x20')](handleEntityNotFound(_0x2c46b5,null))['then'](function(_0x683372){if(_0x683372){_0x5097ca=_0x683372;return db[_0xb93a('0x63')][_0xb93a('0x3c')]({'where':{'SessionId':{'$in':_[_0xb93a('0x27')](_0x5097ca,'id')},'ProjectId':_0x3a1202[_0xb93a('0x40')]['id']},'order':_0xb93a('0x64')});}})[_0xb93a('0x20')](handleEntityNotFound(_0x2c46b5,null))[_0xb93a('0x20')](function(_0x1969e7){if(_0x1969e7){_0x79796=_0x1969e7;var _0x408af6={};for(var _0x58a0d7=0x0,_0x1d0842=_0x79796['length'];_0x58a0d7<_0x1d0842;_0x58a0d7++){if(!_0x408af6[_0xb93a('0x55')](_0x79796[_0x58a0d7][_0xb93a('0x65')])){_0x408af6[_0x79796[_0x58a0d7][_0xb93a('0x65')]]=needsEncapsulation(_0x79796[_0x58a0d7][_0xb93a('0x66')])?encapsulate(_0x79796[_0x58a0d7]['question']):_0x79796[_0x58a0d7]['question'];}}var _0x5e473e=[],_0x239ca0={};for(var _0x12bb32=0x0,_0x349809=_0x5097ca[_0xb93a('0x54')];_0x12bb32<_0x349809;_0x12bb32++){_0x239ca0={'ProjectId':_0x3a1202['params']['id'],'SessionId':_0x5097ca[_0x12bb32]['id'],'StartTime':moment(_0x5097ca[_0x12bb32]['starttime'])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3a86ee=0x0,_0x4d2cc6=_0x79796['length'];_0x3a86ee<_0x4d2cc6;_0x3a86ee++){if(_0x79796[_0x3a86ee][_0xb93a('0x67')]==_0x5097ca[_0x12bb32]['id']&&_0x408af6[_0xb93a('0x55')](_0x79796[_0x3a86ee][_0xb93a('0x65')])){_0x239ca0[_0x408af6[_0x79796[_0x3a86ee][_0xb93a('0x65')]]]=_0x79796[_0x3a86ee][_0xb93a('0x68')];}}for(var _0x468557 in _0x408af6){if(!_0x239ca0[_0xb93a('0x55')](_0x408af6[_0x468557])){_0x239ca0[_0x408af6[_0x468557]]=null;}}_0x5e473e['push'](_0x239ca0);}return _0x5e473e;}})[_0xb93a('0x20')](function(_0x170cd9){if(!_[_0xb93a('0x69')](_0x170cd9)){var _0x53971e=toCsv(_0x170cd9);var _0x4b657c=Date[_0xb93a('0x6a')]();fs[_0xb93a('0x6b')](util[_0xb93a('0x6c')](_0xb93a('0x6d'),_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c),_0x53971e);_0x2c46b5[_0xb93a('0x6e')](_0xb93a('0x6f'),_0xb93a('0x70')+util[_0xb93a('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c));_0x2c46b5['setHeader'](_0xb93a('0x71'),'text/csv');return _0x2c46b5[_0xb93a('0x72')](util[_0xb93a('0x6c')](_0xb93a('0x6d'),_0x3a1202[_0xb93a('0x40')]['id'],_0x4b657c));}else{return _0x2c46b5[_0xb93a('0x17')](0xcc);}})[_0xb93a('0x3e')](handleError(_0x2c46b5,null));};
\ No newline at end of file