diff --git a/modules/monitor/back/methods/sales-monitor/clientsFilter.js b/modules/monitor/back/methods/sales-monitor/clientsFilter.js index d425896e1..ab5a9a10a 100644 --- a/modules/monitor/back/methods/sales-monitor/clientsFilter.js +++ b/modules/monitor/back/methods/sales-monitor/clientsFilter.js @@ -34,8 +34,6 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const date = Date.vnNew(); - date.setHours(0, 0, 0, 0); const stmt = new ParameterizedSQL(` SELECT v.id, d.name salesDepartment, @@ -48,10 +46,7 @@ module.exports = Self => { FROM hedera.visitUser v JOIN client c ON c.id = v.userFk LEFT JOIN department d ON d.id = c.salesDepartmentFk - LEFT JOIN workerDepartment wd ON wd.departmentFk = d.id - LEFT JOIN sharingCart sc ON sc.workerFk = wd.workerFk - AND ? BETWEEN sc.started AND sc.ended`, - [date]); + LEFT JOIN workerDepartment wd ON wd.departmentFk = d.id`); if (!filter.where) filter.where = {}; @@ -62,7 +57,6 @@ module.exports = Self => { stmt.merge(`GROUP BY clientFk, v.stamp`); stmt.merge(conn.makePagination(filter)); - console.log('stmt: ', stmt); return conn.executeStmt(stmt, myOptions); }; }; diff --git a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js index 5418269f0..2fc8781aa 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; describe('SalesMonitor clientsFilter()', () => { - fit('should return the clients web activity', async() => { + it('should return the clients web activity', async() => { const tx = await models.SalesMonitor.beginTransaction({}); try { @@ -19,10 +19,8 @@ describe('SalesMonitor clientsFilter()', () => { } }; const result = await models.SalesMonitor.clientsFilter(ctx, filter, options); - console.log('result: ', result); - console.log('filter: ', from, to); - expect(result.length).toEqual(3); + expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { @@ -52,7 +50,7 @@ describe('SalesMonitor clientsFilter()', () => { const result = await models.SalesMonitor.clientsFilter(ctx, filter, options); - expect(result.length).toEqual(5); + expect(result.length).toEqual(2); await tx.rollback(); } catch (e) { diff --git a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js index 6de322bb8..866b445f4 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/salesFilter.spec.js @@ -180,25 +180,6 @@ describe('SalesMonitor salesFilter()', () => { } }); - it('should now return the tickets that are not from the worker team', async() => { - const tx = await models.SalesMonitor.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const ctx = {req: {accessToken: {userId: 18}}, args: {myTeam: false}}; - const filter = {}; - const result = await models.SalesMonitor.salesFilter(ctx, filter, options); - - expect(result.length).toEqual(4); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - it('should return the tickets sorted by problems descendant', async() => { const tx = await models.SalesMonitor.beginTransaction({}); diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 13b23167c..8a8c1c123 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -186,13 +186,6 @@ module.exports = Self => { return {'ts.stateFk': value}; case 'collectionFk': return {'cll.id': value}; - case 'mine': - case 'myTeam': - if (value) - return {'c.salesDepartmentFk': {inq: teamMembersId}}; - else - return {'c.salesDepartmentFk': {nin: teamMembersId}}; - case 'alertLevel': return {'ts.alertLevel': value}; case 'hasRoute': @@ -205,9 +198,6 @@ module.exports = Self => { return {'t.refFk': null}; case 'pending': return {'st.isNotValidated': value}; - case 'id': - case 'clientFk': - case 'agencyModeFk': case 'warehouseFk': param = `t.${param}`; return {[param]: value}; diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index e495a41f5..8102a8584 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -165,13 +165,13 @@ describe('ticket filter()', () => { } }); - it('should return the tickets from the worker team', async() => { + it('should return the tickets from the salesDeparment', async() => { const tx = await models.Ticket.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 18}}, args: {myTeam: true}}; + const ctx = {req: {accessToken: {userId: 18}}, args: {salesDepartmentFk: 80}}; const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); @@ -184,13 +184,13 @@ describe('ticket filter()', () => { } }); - it('should return the tickets that are not from the worker team', async() => { + it('should return the tickets that are not from the salesDeparment', async() => { const tx = await models.Ticket.beginTransaction({}); try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 18}}, args: {myTeam: false}}; + const ctx = {req: {accessToken: {userId: 18}}, args: {salesDepartmentFk: 80}}; const filter = {}; const result = await models.Ticket.filter(ctx, filter, options);