export production to local, fix test and add fixtures
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-05-09 09:32:04 +02:00
parent 883f0c6b42
commit 1f128797c3
12 changed files with 3196 additions and 2766 deletions

View File

@ -1,11 +0,0 @@
DROP TRIGGER IF EXISTS `vn2008`.`TicketsAfterUpdate`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`TicketsAfterUpdate`
AFTER UPDATE ON `Tickets` FOR EACH ROW
BEGIN
CALL stock.queueAdd ('ticket', NEW.Id_Ticket, OLD.Id_Ticket);
END$$
DELIMITER ;

View File

@ -1,4 +1,4 @@
INSERT INTO `vn`.`sample`(`id`, `code`, `description`, `isVisible`, `hasCompany`)
INSERT INTO `vn`.`sample`(`code`, `description`, `isVisible`, `hasCompany`)
VALUES
(17, 'client-lcr', 'Autorisation pour débit', 1, 1);
('client-lcr', 'Email de solicitud de datos bancarios LCR', 1, 1);

File diff suppressed because one or more lines are too long

View File

@ -281,11 +281,17 @@ UPDATE `vn`.`client` SET defaultAddressFk = 10 WHERE id = 110;
UPDATE `vn`.`client` SET defaultAddressFk = 11 WHERE id = 200;
UPDATE `vn`.`client` SET defaultAddressFk = 12 WHERE id = 400;
UPDATE `vn`.`client` `c`
CREATE TEMPORARY TABLE `tmp`.`clientAddress`
select `c`.`id` `clientFk`,`c`.`name`,`a`.`id` `addressFk` FROM `vn`.`client` `c`
JOIN `vn`.`address` `a` ON `a`.`clientFk` = `c`.`id`
SET `c`.`defaultAddressFk` = `a`.`id`
WHERE `defaultAddressFk` IS NULL;
UPDATE `vn`.`client` `c`
JOIN `tmp`.`clientAddress` `a` ON `a`.`clientFk` = `c`.`id`
SET `c`.`defaultAddressFk` = `a`.`addressFk`;
DROP TEMPORARY TABLE `tmp`.`clientAddress`;
INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`)
VALUES
(1 , 101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
@ -635,7 +641,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
(5, 1, 2, 'Ranged weapon longbow 2m', 10, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY)),
(6, 1, 3, 'Ranged weapon longbow 2m', 15, 6.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY)),
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 1.46, 0, 0, 0, CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 3.04, 0, 0, 0, CURDATE()),
(8, 4, 11, 'Melee weapon heavy shield 1x0.5m', 10, 3.05, 0, 0, 0, CURDATE()),
(9, 1, 16, 'Ranged weapon longbow 2m', 5, 9.10, 0, 0, 0, CURDATE()),
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 1.07, 0, 0, 0, CURDATE()),
(11, 1, 16, 'Ranged weapon longbow 2m', 2, 9.10, 0, 0, 0, CURDATE()),

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ describe('Ticket Edit basic data path', () => {
it(`should select a reason for the changes made then click on finalize`, async() => {
let url = await nightmare
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'No realizar modificaciones en precios')
.autocompleteSearch(selectors.ticketBasicData.chargesReasonAutocomplete, 'Cambiar los precios en el ticket')
.waitToClick(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary')
.parsedUrl();
@ -73,7 +73,7 @@ describe('Ticket Edit basic data path', () => {
.wait(1900)
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
expect(result).toContain('-€203.25');
expect(result).toContain('-€13.95');
});
it(`should then click next to move on to step three`, async() => {

View File

@ -7,6 +7,6 @@ describe('Client get', () => {
expect(result.id).toEqual(101);
expect(result.name).toEqual('Bruce Wayne');
expect(result.debt).toEqual(-14.78);
expect(result.debt).toEqual(-14.65);
});
});

View File

@ -4,7 +4,7 @@ describe('client getDebt()', () => {
it('should return the client debt', async() => {
let result = await app.models.Client.getDebt(101);
expect(result.debt).toEqual(-14.78);
expect(result.debt).toEqual(-14.65);
});
});

View File

@ -17,7 +17,7 @@ describe('client summary()', () => {
it('should return a summary object containing debt', async() => {
let result = await app.models.Client.summary(101);
expect(result.debt.debt).toEqual(-14.78);
expect(result.debt.debt).toEqual(-14.65);
});
it('should return a summary object containing averageInvoiced', async() => {

View File

@ -11,9 +11,9 @@ describe('sale priceDifference()', () => {
};
let result = await app.models.Sale.priceDifference(11, data);
expect(result.totalUnitPrice).toEqual(4.5);
expect(result.totalUnitPrice).toEqual(4.51);
expect(result.totalNewPrice).toEqual(4.24);
expect(result.totalDifference).toEqual(3.75);
expect(result.totalDifference).toEqual(3.85);
});
it('should return an error if the ticket state is not valid for modifications', async() => {

View File

@ -37,8 +37,7 @@ class Controller {
getTotalDifferenceOfPrice() {
let totalPriceDifference = 0;
this.ticket.sale.items.forEach(item => {
let itemTotalPriceDifference = item.quantity * item.component.difference;
totalPriceDifference += itemTotalPriceDifference;
totalPriceDifference += item.component.difference;
});
this.totalPriceDifference = totalPriceDifference;
}

View File

@ -60,7 +60,7 @@ describe('Ticket', () => {
controller.getTotalDifferenceOfPrice();
expect(controller.totalPriceDifference).toEqual(3);
expect(controller.totalPriceDifference).toEqual(0.3);
});
});
});