#2687 - Travel_cloneWithEntries_MYT #2012

Closed
jsegarra wants to merge 6 commits from 2687_travel_cloneWithEntries into dev
3 changed files with 14 additions and 8 deletions

View File

@ -27,7 +27,7 @@ BEGIN
DECLARE vEvaNotes VARCHAR(255);
Review

Esta versio ya esta en test, si es vol modificar s'ha de modificar antes que es fusione en produccio

Esta versio ya esta en test, si es vol modificar s'ha de modificar antes que es fusione en produccio
DECLARE vDone BOOL;
DECLARE vAuxEntryFk INT;
DECLARE vTx BOOLEAN DEFAULT !@@in_transaction;
DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
DECLARE vRsEntry CURSOR FOR
SELECT e.id
FROM entry e
@ -41,9 +41,10 @@ BEGIN
CALL util.tx_rollback(vTx);
RESIGNAL;
END;
IF !vTx THEN
SET vTx = TRUE;
CALL util.tx_start(vTx);
END IF;
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
FROM travel

View File

@ -22,7 +22,6 @@
label="Vehicle"
ng-model="$ctrl.route.vehicleFk"
url="Vehicles"
where="{warehouseFk: $ctrl.vnConfig.warehouseFk}"
show-field="numberPlate">
</vn-autocomplete>
<vn-autocomplete

View File

@ -19,7 +19,7 @@ describe('Travel cloneWithEntries()', () => {
travelFk: newTravelId
}
}, options);
const newTravel = await models.Travel.findById(travelId);
const newTravel = await models.Travel.findById(travelId, options);
expect(newTravelId).not.toEqual(travelId);
expect(newTravel.ref).toEqual('fifth travel');
@ -27,9 +27,15 @@ describe('Travel cloneWithEntries()', () => {
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
expect(travelEntries.length).toBeGreaterThan(0);
await models.Entry.destroyAll({
travelFk: newTravelId
}, options);
await models.Travel.destroyById(newTravelId, options);
await tx.rollback();
Review

Aunque fasa rollback cal borrar les entrades i el travel???

Aunque fasa rollback cal borrar les entrades i el travel???
Review

Lo hablamos, porque aunque hagas rollback, los registros no desaparecen.

Lo hablamos, porque aunque hagas rollback, los registros no desaparecen.
const travelRemoved = await models.Travel.findById(newTravelId, options);
const travelRemoved = await models.Travel.findById(newTravelId);
const entries = await models.Entry.find();
expect(entries.length).toBeGreaterThan(0);
expect(travelRemoved).toBeNull();
} catch (e) {