Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2024-03-26 08:18:47 +01:00
commit dce0155c00
12 changed files with 35 additions and 23 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
coverage
node_modules
dist
storage
.idea
npm-debug.log
.eslintcache

View File

@ -20,8 +20,9 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const [,, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
[userId], myOptions);
const [, , [{collectionFk}]] =
await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
[userId], myOptions);
if (!collectionFk) throw new UserError('There are not picking tickets');
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);

View File

@ -122,7 +122,7 @@ describe('machineWorker updateInTime()', () => {
expect(isNotParked.outTime).toBeNull();
expect(isParked.outTime).toBeDefined();
expect(totalAfter.length).toEqual(totalBefore.length + 1);
expect(totalAfter.length).toEqual(totalBefore.length);
await tx.rollback();
} catch (e) {
await tx.rollback();

View File

@ -48,7 +48,7 @@ module.exports = Self => {
}, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000);
const hoursDifference = (Date.vnNow() - machineWorker?.inTimed?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) {
const isHimself = userId == machineWorker.workerFk;

View File

@ -40,6 +40,11 @@ module.exports = Self => {
fields,
};
return Self.findOne(filter);
const result = await Self.findOne(filter);
return {
isVersionCritical: result?.isVersionBetaCritical ?? result?.isVersionCritical,
version: result?.versionBeta ?? result?.version,
url: result?.urlBeta ?? result?.urlProduction
};
};
};

View File

@ -2,6 +2,8 @@ const {models} = require('vn-loopback/server/server');
describe('mobileAppVersionControl getVersion()', () => {
const appName = 'delivery';
const appNameVersion = '9.2';
const appNameVersionBeta = '9.7';
beforeAll(async() => {
ctx = {
req: {
@ -13,17 +15,15 @@ describe('mobileAppVersionControl getVersion()', () => {
it('should get the version app', async() => {
ctx.req.accessToken.userId = 9;
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
expect(version).toEqual('9.2');
expect(versionBeta).toBeUndefined();
expect(version).toEqual(appNameVersion);
});
it('should get the beta version app', async() => {
ctx.req.accessToken.userId = 66;
const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName);
const {version} = await models.MobileAppVersionControl.getVersion(ctx, appName);
expect(versionBeta).toBeDefined();
expect(version).toBeUndefined();
expect(version).toEqual(appNameVersionBeta);
});
});

View File

@ -21,6 +21,8 @@ BEGIN
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated);
-- Añadido temporalmente para ver si ya no sucede el cuelgue de db
SET vShowType = TRUE;
WITH itemTags AS (
SELECT i.id,
@ -87,6 +89,7 @@ BEGIN
(i.tag7 = its.tag7) DESC,
match7 DESC,
(i.tag8 = its.tag8) DESC,
match8 DESC;
match8 DESC
LIMIT 100;
END$$
DELIMITER ;

View File

@ -0,0 +1,7 @@
-- Place your SQL code here
USE vn;
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
VALUES
('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'),
('Ticket', 'addSaleByCode', 'WRITE', 'ALLOW', 'ROLE', 'production');

View File

@ -347,6 +347,7 @@
"Cmr file does not exist": "El archivo del cmr no existe",
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
"The line could not be marked": "La linea no puede ser marcada",
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
"They're not your subordinate": "No es tu subordinado/a."
}

View File

@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
// #6276
xdescribe('ItemShelving upsertItem()', () => {
describe('ItemShelving upsertItem()', () => {
const warehouseFk = 1;
let ctx;
let options;
@ -30,7 +30,7 @@ xdescribe('ItemShelving upsertItem()', () => {
await tx.rollback();
});
it('should add two new records', async() => {
xit('should add two new records', async() => {
const shelvingFk = 'ZPP';
const items = [1, 1, 1, 2];
@ -40,7 +40,7 @@ xdescribe('ItemShelving upsertItem()', () => {
expect(itemShelvings.length).toEqual(2);
});
it('should update the visible items', async() => {
xit('should update the visible items', async() => {
const shelvingFk = 'GVC';
const items = [2, 2];
const {visible: itemsBefore} = await models.ItemShelving.findOne({

View File

@ -89,16 +89,10 @@ module.exports = Self => {
const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions);
if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions);
} catch (e) {
throw new UserError('The sale cannot be tracked');
if (tx) await tx.commit();
}
if (tx) await tx.commit();
} catch (e) {
if (e.message == 'The sale cannot be tracked') {
if (tx) tx.commit();
throw e;
}
if (tx) await tx.rollback();
throw new UserError('The line could not be marked');
}

View File

@ -79,7 +79,7 @@ describe('saleTracking setPicked()', () => {
} catch (e) {
const error = e;
expect(error.message).toEqual('The sale cannot be tracked');
expect(error.message).toEqual('The line could not be marked');
await tx.rollback();
}
});