From 29093d7d30e98083c36ee81bebb5c5ed95453020 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Oct 2022 14:25:55 +0200 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20en=20vez=20de=20consultar=20si=20?= =?UTF-8?q?el=20usuario=20est=C3=A1=20en=20la=20tabla=20workerMana,=20cons?= =?UTF-8?q?ultar=20es=20si=20el=20usuario=20est=C3=A1=20en=20un=20departam?= =?UTF-8?q?ento=20que=20cuelga=20de=20ventas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../back/methods/sale/specs/updatePrice.spec.js | 11 ++++++++++- modules/ticket/back/methods/sale/updatePrice.js | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js index e76511421e..75be665fb3 100644 --- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js +++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js @@ -79,10 +79,19 @@ describe('sale updatePrice()', () => { const price = 5.4; const originalSalesPersonMana = await models.WorkerMana.findById(18, null, options); const manaComponent = await models.Component.findOne({where: {code: 'mana'}}, options); + const teamCLopez = 96; + const userId = 18; + await models.Sale.rawSql(`UPDATE vn.business b + JOIN vn.department d ON d.id = b.departmentFk + SET b.departmentFk = ? + WHERE b.id = ?`, [teamCLopez, userId]); await models.Sale.updatePrice(ctx, saleId, price, options); const updatedSale = await models.Sale.findById(saleId, null, options); - createdSaleComponent = await models.SaleComponent.findOne({where: {saleFk: saleId, componentFk: manaComponent.id}}, options); + const createdSaleComponent = await models.SaleComponent.findOne({ + where: { + saleFk: saleId, componentFk: manaComponent.id + }}, options); expect(updatedSale.price).toBe(price); expect(createdSaleComponent.value).toEqual(-2.04); diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index bbd9d154db..dbd4ed091a 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -77,7 +77,12 @@ module.exports = Self => { const oldPrice = sale.price; const userId = ctx.req.accessToken.userId; - const usesMana = await models.WorkerMana.findOne({where: {workerFk: userId}, fields: 'amount'}, myOptions); + + const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); + const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); + const workerDepartment = await models.WorkerDepartment.findById(userId); + const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); + const componentCode = usesMana ? 'mana' : 'buyerDiscount'; const discount = await models.Component.findOne({where: {code: componentCode}}, myOptions); const componentId = discount.id; @@ -88,7 +93,6 @@ module.exports = Self => { saleFk: id }; const saleComponent = await models.SaleComponent.findOne({where}, myOptions); - if (saleComponent) { await models.SaleComponent.updateAll(where, { value: saleComponent.value + componentValue From 6891190c72e019cb8c2c2232a028e27a47a1ea56 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 20 Oct 2022 15:05:46 +0200 Subject: [PATCH 02/11] refactor: create endpoint to unify code --- db/changes/10491-august/00-aclUsesMana.sql | 3 ++ .../ticket/back/methods/sale/updatePrice.js | 10 +++--- modules/ticket/back/methods/sale/usesMana.js | 31 +++++++++++++++++++ modules/ticket/back/models/sale.js | 1 + 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 db/changes/10491-august/00-aclUsesMana.sql create mode 100644 modules/ticket/back/methods/sale/usesMana.js diff --git a/db/changes/10491-august/00-aclUsesMana.sql b/db/changes/10491-august/00-aclUsesMana.sql new file mode 100644 index 0000000000..5bb7178dd4 --- /dev/null +++ b/db/changes/10491-august/00-aclUsesMana.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Sale', 'usesMana', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index dbd4ed091a..d325d6eaa4 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -78,11 +78,13 @@ module.exports = Self => { const oldPrice = sale.price; const userId = ctx.req.accessToken.userId; - const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); - const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); - const workerDepartment = await models.WorkerDepartment.findById(userId); - const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); + // const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); + // const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); + // const workerDepartment = await models.WorkerDepartment.findById(userId); + // const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); + const usesMana = await models.Sale.usesMana(); + console.log(usesMana ? 'mana' : 'buyerDiscount'); const componentCode = usesMana ? 'mana' : 'buyerDiscount'; const discount = await models.Component.findOne({where: {code: componentCode}}, myOptions); const componentId = discount.id; diff --git a/modules/ticket/back/methods/sale/usesMana.js b/modules/ticket/back/methods/sale/usesMana.js new file mode 100644 index 0000000000..7ff2a5e2a6 --- /dev/null +++ b/modules/ticket/back/methods/sale/usesMana.js @@ -0,0 +1,31 @@ +module.exports = Self => { + Self.remoteMethodCtx('usesMana', { + description: 'Returns if the worker uses mana', + accessType: 'WRITE', + accepts: [], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/usesMana`, + verb: 'POST' + } + }); + + Self.usesMana = async(ctx, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); + const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); + const workerDepartment = await models.WorkerDepartment.findById(userId); + const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); + + return usesMana ? true : false; + }; +}; diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 2a4457263d..ae247fc242 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -8,6 +8,7 @@ module.exports = Self => { require('../methods/sale/recalculatePrice')(Self); require('../methods/sale/refund')(Self); require('../methods/sale/canEdit')(Self); + require('../methods/sale/usesMana')(Self); Self.validatesPresenceOf('concept', { message: `Concept cannot be blank` From 5da29fe38158e71d3d8fab36fd2fb9deab0bf137 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 08:00:24 +0200 Subject: [PATCH 03/11] refactor: unify duplicated code --- modules/ticket/back/methods/sale/updatePrice.js | 8 +------- modules/ticket/back/methods/sale/usesMana.js | 6 +++--- modules/ticket/back/methods/ticket/updateDiscount.js | 7 +------ 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/modules/ticket/back/methods/sale/updatePrice.js b/modules/ticket/back/methods/sale/updatePrice.js index d325d6eaa4..302522cfbc 100644 --- a/modules/ticket/back/methods/sale/updatePrice.js +++ b/modules/ticket/back/methods/sale/updatePrice.js @@ -78,13 +78,7 @@ module.exports = Self => { const oldPrice = sale.price; const userId = ctx.req.accessToken.userId; - // const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); - // const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); - // const workerDepartment = await models.WorkerDepartment.findById(userId); - // const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); - - const usesMana = await models.Sale.usesMana(); - console.log(usesMana ? 'mana' : 'buyerDiscount'); + const usesMana = await models.Sale.usesMana(ctx, myOptions); const componentCode = usesMana ? 'mana' : 'buyerDiscount'; const discount = await models.Component.findOne({where: {code: componentCode}}, myOptions); const componentId = discount.id; diff --git a/modules/ticket/back/methods/sale/usesMana.js b/modules/ticket/back/methods/sale/usesMana.js index 7ff2a5e2a6..093057dca4 100644 --- a/modules/ticket/back/methods/sale/usesMana.js +++ b/modules/ticket/back/methods/sale/usesMana.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethodCtx('usesMana', { description: 'Returns if the worker uses mana', - accessType: 'WRITE', + accessType: 'READ', accepts: [], returns: { type: 'boolean', @@ -9,7 +9,7 @@ module.exports = Self => { }, http: { path: `/usesMana`, - verb: 'POST' + verb: 'GET' } }); @@ -23,7 +23,7 @@ module.exports = Self => { const salesDepartment = await models.Department.findOne({where: {code: 'VT'}, fields: 'id'}, myOptions); const departments = await models.Department.getLeaves(salesDepartment.id, null, myOptions); - const workerDepartment = await models.WorkerDepartment.findById(userId); + const workerDepartment = await models.WorkerDepartment.findById(userId, null, myOptions); const usesMana = departments.find(department => department.id == workerDepartment.departmentFk); return usesMana ? true : false; diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js index b1291a45bf..9419b9a40b 100644 --- a/modules/ticket/back/methods/ticket/updateDiscount.js +++ b/modules/ticket/back/methods/ticket/updateDiscount.js @@ -98,12 +98,7 @@ module.exports = Self => { if (isLocked || (!hasAllowedRoles && alertLevel > 0)) throw new UserError(`The sales of this ticket can't be modified`); - const usesMana = await models.WorkerMana.findOne({ - where: { - workerFk: userId - }, - fields: 'amount'}, myOptions); - + const usesMana = await models.Sale.usesMana(ctx); const componentCode = usesMana ? manaCode : 'buyerDiscount'; const discountComponent = await models.Component.findOne({ where: {code: componentCode}}, myOptions); From 6f31bea21f50306ef47133afeacb447b2fb709a0 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 08:00:48 +0200 Subject: [PATCH 04/11] feat: update testBack --- db/changes/10491-august/00-aclBusiness.sql | 3 ++ modules/client/back/model-config.json | 3 ++ modules/client/back/models/business.json | 27 +++++++++++ .../methods/sale/specs/updatePrice.spec.js | 11 ++--- .../back/methods/sale/specs/usesMana.spec.js | 48 +++++++++++++++++++ 5 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 db/changes/10491-august/00-aclBusiness.sql create mode 100644 modules/client/back/models/business.json create mode 100644 modules/ticket/back/methods/sale/specs/usesMana.spec.js diff --git a/db/changes/10491-august/00-aclBusiness.sql b/db/changes/10491-august/00-aclBusiness.sql new file mode 100644 index 0000000000..f1f7a36323 --- /dev/null +++ b/db/changes/10491-august/00-aclBusiness.sql @@ -0,0 +1,3 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('Business', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index b2e600610e..4ef34ca3a6 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -8,6 +8,9 @@ "BankEntity": { "dataSource": "vn" }, + "Business": { + "dataSource": "vn" + }, "BusinessType": { "dataSource": "vn" }, diff --git a/modules/client/back/models/business.json b/modules/client/back/models/business.json new file mode 100644 index 0000000000..7ad2d307ff --- /dev/null +++ b/modules/client/back/models/business.json @@ -0,0 +1,27 @@ +{ + "name": "Business", + "base": "VnModel", + "options": { + "mysql": { + "table": "business" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "department": { + "type": "belongsTo", + "model": "Department", + "foreignKey": "departmentFk" + } + } +} \ No newline at end of file diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js index 75be665fb3..f8cb5a4ecd 100644 --- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js +++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -describe('sale updatePrice()', () => { +fdescribe('sale updatePrice()', () => { const ctx = { req: { accessToken: {userId: 18}, @@ -80,11 +80,10 @@ describe('sale updatePrice()', () => { const originalSalesPersonMana = await models.WorkerMana.findById(18, null, options); const manaComponent = await models.Component.findOne({where: {code: 'mana'}}, options); const teamCLopez = 96; - const userId = 18; - await models.Sale.rawSql(`UPDATE vn.business b - JOIN vn.department d ON d.id = b.departmentFk - SET b.departmentFk = ? - WHERE b.id = ?`, [teamCLopez, userId]); + const userId = ctx.req.accessToken.userId; + + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamCLopez, options); await models.Sale.updatePrice(ctx, saleId, price, options); const updatedSale = await models.Sale.findById(saleId, null, options); diff --git a/modules/ticket/back/methods/sale/specs/usesMana.spec.js b/modules/ticket/back/methods/sale/specs/usesMana.spec.js new file mode 100644 index 0000000000..4e14ed2c96 --- /dev/null +++ b/modules/ticket/back/methods/sale/specs/usesMana.spec.js @@ -0,0 +1,48 @@ +const models = require('vn-loopback/server/server').models; + +describe('sale usesMana()', () => { + const ctx = { + req: { + accessToken: {userId: 18} + } + }; + + it('should return that the worker uses mana', async() => { + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + const teamCLopez = 96; + const userId = ctx.req.accessToken.userId; + + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamCLopez, options); + + const usesMana = await models.Sale.usesMana(ctx, options); + + expect(usesMana).toBe(true); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should return that the worker not uses mana', async() => { + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const usesMana = await models.Sale.usesMana(ctx, options); + + expect(usesMana).toBe(false); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); From e7261573d7954cd9ce129efc0dd945e1114febfe Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 08:01:22 +0200 Subject: [PATCH 05/11] delete focus --- modules/ticket/back/methods/sale/specs/updatePrice.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js index f8cb5a4ecd..15b00a7329 100644 --- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js +++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -fdescribe('sale updatePrice()', () => { +describe('sale updatePrice()', () => { const ctx = { req: { accessToken: {userId: 18}, From 2d0cb60b50825144113edde29f97f084240002ac Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 08:55:05 +0200 Subject: [PATCH 06/11] feat: check if uses mana --- modules/ticket/front/sale/index.html | 14 ++++++++++++-- modules/ticket/front/sale/index.js | 8 ++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 42eb10cb06..35e45a8120 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -264,6 +264,16 @@ + + + + + + @@ -278,7 +288,7 @@
-
Mana: {{::$ctrl.edit.mana | currency: 'EUR':0}}
+
MANÁ: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
- + { + this.useMana = res.data; + }); + } + /** * Returns checked instances * From c33cab7b10b94be095f0b96e4c2860e68e3fcf36 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 09:01:08 +0200 Subject: [PATCH 07/11] fix: test back --- .../back/methods/ticket/specs/updateDiscount.spec.js | 10 ++++++++++ modules/ticket/back/methods/ticket/updateDiscount.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js index 1873207aad..5249fe5d88 100644 --- a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js @@ -110,6 +110,11 @@ describe('sale updateDiscount()', () => { const componentId = manaDiscount.id; const manaCode = 'mana'; + const teamCLopez = 96; + const userId = ctx.req.accessToken.userId; + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamCLopez, options); + await models.Ticket.updateDiscount(ctx, ticketId, sales, newDiscount, manaCode, options); const updatedSale = await models.Sale.findById(originalSaleId, null, options); @@ -150,6 +155,11 @@ describe('sale updateDiscount()', () => { const componentId = manaDiscount.id; const manaCode = 'manaClaim'; + const teamCLopez = 96; + const userId = ctx.req.accessToken.userId; + const business = await models.Business.findOne({where: {workerFk: userId}}, options); + await business.updateAttribute('departmentFk', teamCLopez, options); + await models.Ticket.updateDiscount(ctx, ticketId, sales, newDiscount, manaCode, options); const updatedSale = await models.Sale.findById(originalSaleId, null, options); diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js index 9419b9a40b..8bc79ca9c3 100644 --- a/modules/ticket/back/methods/ticket/updateDiscount.js +++ b/modules/ticket/back/methods/ticket/updateDiscount.js @@ -98,7 +98,7 @@ module.exports = Self => { if (isLocked || (!hasAllowedRoles && alertLevel > 0)) throw new UserError(`The sales of this ticket can't be modified`); - const usesMana = await models.Sale.usesMana(ctx); + const usesMana = await models.Sale.usesMana(ctx, myOptions); const componentCode = usesMana ? manaCode : 'buyerDiscount'; const discountComponent = await models.Component.findOne({ where: {code: componentCode}}, myOptions); From f968b19d1e2603036050fbc2b5b17680f5b05d13 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 09:08:17 +0200 Subject: [PATCH 08/11] fix: testFront --- modules/ticket/front/sale/index.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 28d8749328..a7260a3ec4 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -115,6 +115,7 @@ describe('Ticket', () => { const expectedAmount = 250; $httpBackend.expect('GET', 'Tickets/1/getSalesPersonMana').respond(200, expectedAmount); + $httpBackend.expect('GET', 'Sales/usesMana').respond(200); $httpBackend.expect('GET', 'WorkerManas/getCurrentWorkerMana').respond(200, expectedAmount); controller.getMana(); $httpBackend.flush(); From 18c119c62a88a0e1959d1af2e00d22f9a91e37b1 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 21 Oct 2022 09:20:27 +0200 Subject: [PATCH 09/11] change acl --- db/changes/10491-august/00-aclBusiness.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/10491-august/00-aclBusiness.sql b/db/changes/10491-august/00-aclBusiness.sql index f1f7a36323..8ea2c6d83b 100644 --- a/db/changes/10491-august/00-aclBusiness.sql +++ b/db/changes/10491-august/00-aclBusiness.sql @@ -1,3 +1,3 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('Business', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file + ('Business', '*', '*', 'ALLOW', 'ROLE', 'hr'); \ No newline at end of file From d1e2b1f7d5ff9b98b8d62554e879c539937337dc Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 26 Oct 2022 09:02:54 +0200 Subject: [PATCH 10/11] refactor: tranducciones --- modules/ticket/front/sale/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 35e45a8120..c681381411 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -244,7 +244,7 @@
-
MANÁ: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
+
Mana: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
-
MANÁ: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
+
Mana: {{::$ctrl.edit.mana | currency: 'EUR': 0}}
Date: Wed, 26 Oct 2022 09:04:53 +0200 Subject: [PATCH 11/11] refactor: renombrada variable --- .../ticket/back/methods/sale/specs/updatePrice.spec.js | 4 ++-- modules/ticket/back/methods/sale/specs/usesMana.spec.js | 4 ++-- .../back/methods/ticket/specs/updateDiscount.spec.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js index 15b00a7329..51cd2403f1 100644 --- a/modules/ticket/back/methods/sale/specs/updatePrice.spec.js +++ b/modules/ticket/back/methods/sale/specs/updatePrice.spec.js @@ -79,11 +79,11 @@ describe('sale updatePrice()', () => { const price = 5.4; const originalSalesPersonMana = await models.WorkerMana.findById(18, null, options); const manaComponent = await models.Component.findOne({where: {code: 'mana'}}, options); - const teamCLopez = 96; + const teamOne = 96; const userId = ctx.req.accessToken.userId; const business = await models.Business.findOne({where: {workerFk: userId}}, options); - await business.updateAttribute('departmentFk', teamCLopez, options); + await business.updateAttribute('departmentFk', teamOne, options); await models.Sale.updatePrice(ctx, saleId, price, options); const updatedSale = await models.Sale.findById(saleId, null, options); diff --git a/modules/ticket/back/methods/sale/specs/usesMana.spec.js b/modules/ticket/back/methods/sale/specs/usesMana.spec.js index 4e14ed2c96..777bdc8f0a 100644 --- a/modules/ticket/back/methods/sale/specs/usesMana.spec.js +++ b/modules/ticket/back/methods/sale/specs/usesMana.spec.js @@ -12,11 +12,11 @@ describe('sale usesMana()', () => { try { const options = {transaction: tx}; - const teamCLopez = 96; + const teamOne = 96; const userId = ctx.req.accessToken.userId; const business = await models.Business.findOne({where: {workerFk: userId}}, options); - await business.updateAttribute('departmentFk', teamCLopez, options); + await business.updateAttribute('departmentFk', teamOne, options); const usesMana = await models.Sale.usesMana(ctx, options); diff --git a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js index 5249fe5d88..1f6712087d 100644 --- a/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateDiscount.spec.js @@ -110,10 +110,10 @@ describe('sale updateDiscount()', () => { const componentId = manaDiscount.id; const manaCode = 'mana'; - const teamCLopez = 96; + const teamOne = 96; const userId = ctx.req.accessToken.userId; const business = await models.Business.findOne({where: {workerFk: userId}}, options); - await business.updateAttribute('departmentFk', teamCLopez, options); + await business.updateAttribute('departmentFk', teamOne, options); await models.Ticket.updateDiscount(ctx, ticketId, sales, newDiscount, manaCode, options); @@ -155,10 +155,10 @@ describe('sale updateDiscount()', () => { const componentId = manaDiscount.id; const manaCode = 'manaClaim'; - const teamCLopez = 96; + const teamOne = 96; const userId = ctx.req.accessToken.userId; const business = await models.Business.findOne({where: {workerFk: userId}}, options); - await business.updateAttribute('departmentFk', teamCLopez, options); + await business.updateAttribute('departmentFk', teamOne, options); await models.Ticket.updateDiscount(ctx, ticketId, sales, newDiscount, manaCode, options);