fix test and update fixtures for procedure manaSpelleersRequery

This commit is contained in:
Bernat 2018-06-26 11:28:29 +02:00
parent dfa1d1edb2
commit 49f8770584
2 changed files with 16 additions and 15 deletions

View File

@ -166,10 +166,10 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city
INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
VALUES
( 101, 50, CURDATE()),
( 102, 100, CURDATE()),
( 103, 0, CURDATE()),
( 104, -30, CURDATE());
( 101, 50, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
( 102, 100, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
( 103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
( 104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH));
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`)
VALUES
@ -504,7 +504,9 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
( 3, 28, 1),
( 4, 28, 1),
( 4, 10, 1),
( 2, 17, 3.5);
( 2, 17, 3.5),
( 4, 39, 5),
( 4, 37, 2);
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`)
VALUES
@ -624,15 +626,6 @@ INSERT INTO `cache`.`cache_calc`(`id`, `cache_id`, `cacheName`, `params`, `last_
( 2, 4, 'last_buy', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL),
( 3, 8, 'visible', CONCAT_WS('/',1,CURDATE()), CURRENT_TIMESTAMP(), DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 15 MINUTE), CURDATE(), NULL);
INSERT INTO `bs`.`workerMana`(`workerFk`, `amount`)
VALUES
( 1, -500),
( 3, 0),
( 5, 250),
( 6, 1000),
( 9, 1500);
INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
VALUES
( 1, 0),
@ -722,3 +715,11 @@ INSERT INTO `vn`.`clientContact`(`id`, `clientFk`, `name`, `phone`)
( 3, 101, 'contact 3', 222333444),
( 4, 102, 'contact 1', 876543219);
/*
el mana de los trabajadores lo podemos poner a mano en la tabla si lo calculamos antes,
pero si hazemos alguna modificacion en alguna tabla que utiliza para calcularlo ya no seria correcto
La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets
*/
call vn.manaSpellersRequery(19);
call vn.manaSpellersRequery(18);

View File

@ -4,7 +4,7 @@ describe('client getMana()', () => {
it('should call the getMana method', done => {
app.models.Client.getMana(101)
.then(response => {
expect(response.mana).toEqual(50);
expect(response.mana).toEqual(190);
done();
});
});