diff --git a/modules/ticket/back/methods/sale/recalculatePrice.js b/modules/ticket/back/methods/sale/recalculatePrice.js index 7a92ba08b..8a390223d 100644 --- a/modules/ticket/back/methods/sale/recalculatePrice.js +++ b/modules/ticket/back/methods/sale/recalculatePrice.js @@ -11,7 +11,7 @@ module.exports = Self => { http: {source: 'body'} }], returns: { - type: 'Number', + type: 'number', root: true }, http: { diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index bbf33417c..752ed23ba 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -453,9 +453,8 @@ class Controller extends Section { const sales = this.selectedValidSales(); if (!sales) return; - const params = sales; const query = `Sales/recalculatePrice`; - this.$http.post(query, params).then(() => { + this.$http.post(query, sales).then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); this.$.model.refresh(); }); diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index f04d8ea54..673e9a3f9 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -684,14 +684,13 @@ describe('Ticket', () => { }); describe('calculateSalePrice()', () => { - it('should make an HTTP post query ', () => { + it('should make an HTTP post query', () => { jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis(); jest.spyOn(controller.$.model, 'refresh').mockReturnThis(); - const selectedSaleOne = controller.sales[0]; - const selectedSaleTwo = controller.sales[1]; - selectedSaleOne.checked = true; - selectedSaleTwo.checked = true; + controller.sales.forEach(sale => { + sale.checked = true; + }); $httpBackend.expect('POST', `Sales/recalculatePrice`).respond(200); controller.calculateSalePrice();