From fa32cf37cd35bb7a9aa625b8f7c070cf12aacf4a Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 2 Feb 2024 14:04:20 +0100 Subject: [PATCH 1/6] refs #6053 cpus --- jest.front.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jest.front.config.js b/jest.front.config.js index 3289df8bb..955f06eca 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -1,7 +1,9 @@ // For a detailed explanation regarding each configuration property, visit: // https://jestjs.io/docs/en/configuration.html /* eslint max-len: ["error", { "code": 150 }]*/ +const cpus = require('os').cpus().length; +const maxCpus = Math.floor(cpus / 5) - 1; module.exports = { name: 'front end', displayName: { @@ -12,6 +14,7 @@ module.exports = { setupFilesAfterEnv: [ './jest-front.js' ], + maxWorkers: maxCpus, testMatch: [ '**/front/**/*.spec.js', '**/print/**/*.spec.js', From 934278b0181c14f109a95afbb8aec71b4147c0c9 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 19 Feb 2024 08:45:43 +0100 Subject: [PATCH 2/6] refs #6053 maxCPUs 4 --- jest.front.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jest.front.config.js b/jest.front.config.js index 955f06eca..4cbfa2353 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -2,8 +2,10 @@ // https://jestjs.io/docs/en/configuration.html /* eslint max-len: ["error", { "code": 150 }]*/ const cpus = require('os').cpus().length; +console.log('cpus: ', cpus); +const maxCpus = Math.floor(cpus / 4); +console.log('maxCpus: ', maxCpus); -const maxCpus = Math.floor(cpus / 5) - 1; module.exports = { name: 'front end', displayName: { From 8263b203a79f336441036af27fbf2e608d2cd0a4 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 26 Feb 2024 18:38:50 +0100 Subject: [PATCH 3/6] remove(claimRma): refs #6349 remove --- db/dump/.dump/data.sql | 2 -- db/dump/fixtures.before.sql | 8 ----- .../10913-bronzeGalax/00-firstScript.sql | 4 +++ modules/claim/back/model-config.json | 5 +--- modules/claim/back/models/claim-rma.js | 9 ------ modules/claim/back/models/claim-rma.json | 30 ------------------- modules/claim/back/models/claim.json | 9 ------ myt.config.yml | 1 - 8 files changed, 5 insertions(+), 63 deletions(-) create mode 100644 db/versions/10913-bronzeGalax/00-firstScript.sql delete mode 100644 modules/claim/back/models/claim-rma.js delete mode 100644 modules/claim/back/models/claim-rma.json diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index d7e99a4ee..979f7d738 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -1356,8 +1356,6 @@ INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','em INSERT INTO `ACL` VALUES (386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'); INSERT INTO `ACL` VALUES (388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'); -INSERT INTO `ACL` VALUES (389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'); -INSERT INTO `ACL` VALUES (390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'); INSERT INTO `ACL` VALUES (391,'Notification','*','WRITE','ALLOW','ROLE','system'); INSERT INTO `ACL` VALUES (392,'Boxing','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (393,'Url','*','READ','ALLOW','ROLE','employee'); diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 7ba85d8d5..14380c897 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1880,14 +1880,6 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa (1103, 2000, 0.00, 0.00, 0.02, 1.00), (1104, 2500, 150.00, 0.02, 0.10, 1.00); -INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`) - VALUES - (1, '02676A049183', DEFAULT, 1106), - (2, '02676A049183', DEFAULT, 1106), - (3, '02676A049183', DEFAULT, 1107), - (4, '02676A049183', DEFAULT, 1107), - (5, '01837B023653', DEFAULT, 1106); - INSERT INTO `vn`.`claimLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`) VALUES (1, 18, 'update', 'Claim', '{"hasToPickUp":false}', '{"hasToPickUp":true}', 1, NULL), diff --git a/db/versions/10913-bronzeGalax/00-firstScript.sql b/db/versions/10913-bronzeGalax/00-firstScript.sql new file mode 100644 index 000000000..aef0c8738 --- /dev/null +++ b/db/versions/10913-bronzeGalax/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Place your SQL code here +RENAME TABLE IF EXISTS vn.claimRma TO vn.claimRma__; +ALTER TABLE IF EXISTS vn.claimRma__ COMMENT='kkeada el 2024-02-26 por Pablo'; +ALTER TABLE vn.claim CHANGE IF EXISTS rma rma__ varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL; diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json index 83d88039c..d90ed4c1e 100644 --- a/modules/claim/back/model-config.json +++ b/modules/claim/back/model-config.json @@ -43,8 +43,5 @@ }, "ClaimObservation": { "dataSource": "vn" - }, - "ClaimRma": { - "dataSource": "vn" - } + } } diff --git a/modules/claim/back/models/claim-rma.js b/modules/claim/back/models/claim-rma.js deleted file mode 100644 index 6a93613bd..000000000 --- a/modules/claim/back/models/claim-rma.js +++ /dev/null @@ -1,9 +0,0 @@ -const LoopBackContext = require('loopback-context'); - -module.exports = Self => { - Self.observe('before save', async function(ctx) { - const changes = ctx.data || ctx.instance; - const loopBackContext = LoopBackContext.getCurrentContext(); - changes.workerFk = loopBackContext.active.accessToken.userId; - }); -}; diff --git a/modules/claim/back/models/claim-rma.json b/modules/claim/back/models/claim-rma.json deleted file mode 100644 index 27c3c9729..000000000 --- a/modules/claim/back/models/claim-rma.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "ClaimRma", - "base": "VnModel", - "options": { - "mysql": { - "table": "claimRma" - } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "description": "Identifier" - }, - "code": { - "type": "string", - "required": true - }, - "created": { - "type": "date" - } - }, - "relations": { - "worker": { - "type": "belongsTo", - "model": "Worker", - "foreignKey": "workerFk" - } - } -} diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index b85b9e073..1fbbb00b1 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -45,9 +45,6 @@ }, "packages": { "type": "number" - }, - "rma": { - "type": "string" } }, "relations": { @@ -56,12 +53,6 @@ "model": "ClaimState", "foreignKey": "claimStateFk" }, - "rmas": { - "type": "hasMany", - "model": "ClaimRma", - "foreignKey": "code", - "primaryKey": "rma" - }, "client": { "type": "belongsTo", "model": "Client", diff --git a/myt.config.yml b/myt.config.yml index 0b1d62d25..d7d1ad181 100755 --- a/myt.config.yml +++ b/myt.config.yml @@ -179,7 +179,6 @@ localFixtures: - claimLog - claimObservation - claimRatio - - claimRma - claimState - client - clientConfig From afaa5fee7d64fc28bb43cdc2830ac3d48364d5d5 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 26 Feb 2024 19:00:45 +0100 Subject: [PATCH 4/6] fix(spec): refs #6349 fix fixtures --- db/dump/fixtures.before.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 14380c897..effb83819 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1826,12 +1826,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, ( 6, 'mana', 'Mana', 72, 4, 0), ( 7, 'lack', 'Faltas', 72, 2, 0); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`, `ticketFk`) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `ticketFk`) VALUES - (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183', 11), - (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL, 16), - (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL, 7), - (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL, 8); + (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, 11), + (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, 16), + (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, 7), + (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, 8); INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) VALUES From 1fe665357ffdd3aef8a5f8a41ebdd861ddcea644 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 27 Feb 2024 10:05:46 +0100 Subject: [PATCH 5/6] refs #6053 fix cpus --- jest.front.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jest.front.config.js b/jest.front.config.js index b631a234a..4b292801e 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -2,9 +2,7 @@ // https://jestjs.io/docs/en/configuration.html /* eslint max-len: ["error", { "code": 150 }]*/ const cpus = require('os').cpus().length; -console.log('cpus: ', cpus); -const maxCpus = Math.floor(cpus / 4); -console.log('maxCpus: ', maxCpus); +const maxCpus = Math.floor(cpus * 0.45); module.exports = { name: 'front end', From 594780d6cb57b4f0119651a6be3c34907ae37f09 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 29 Feb 2024 13:44:49 +0100 Subject: [PATCH 6/6] feat: refs #6958 delete sale_checkNoComponents --- .../vn/events/sale_checkWithoutComponents.sql | 8 --- .../vn/procedures/sale_checkNoComponents.sql | 70 ------------------- 2 files changed, 78 deletions(-) delete mode 100644 db/routines/vn/events/sale_checkWithoutComponents.sql delete mode 100644 db/routines/vn/procedures/sale_checkNoComponents.sql diff --git a/db/routines/vn/events/sale_checkWithoutComponents.sql b/db/routines/vn/events/sale_checkWithoutComponents.sql deleted file mode 100644 index 2a1ced6ca..000000000 --- a/db/routines/vn/events/sale_checkWithoutComponents.sql +++ /dev/null @@ -1,8 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`sale_checkWithoutComponents` - ON SCHEDULE EVERY 10 MINUTE - STARTS '2020-05-04 11:56:23.000' - ON COMPLETION PRESERVE - ENABLE -DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE))$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/sale_checkNoComponents.sql b/db/routines/vn/procedures/sale_checkNoComponents.sql deleted file mode 100644 index 79abbbf92..000000000 --- a/db/routines/vn/procedures/sale_checkNoComponents.sql +++ /dev/null @@ -1,70 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME) -BEGIN -/** - * Comprueba que las ventas creadas entre un rango de fechas tienen componentes - * - * @param vCreatedFrom inicio del rango - * @param vCreatedTo fin del rango - */ - DECLARE v_done BOOL DEFAULT FALSE; - DECLARE vSaleFk INTEGER; - DECLARE vTicketFk INTEGER; - DECLARE vConcept VARCHAR(50); - DECLARE vCur CURSOR FOR - SELECT s.id - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - LEFT JOIN tmp.coste c ON c.id = s.id - WHERE s.created >= vCreatedFrom AND s.created <= vCreatedTo - AND c.id IS NULL - AND t.agencyModeFk IS NOT NULL - AND t.isDeleted IS FALSE - AND t.warehouseFk = 60 - AND ic.merchandise != FALSE - GROUP BY s.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - CREATE TEMPORARY TABLE tmp.coste - (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT s.id - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - JOIN saleComponent sc ON sc.saleFk = s.id - JOIN component c ON c.id = sc.componentFk - JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 6 - WHERE s.created >= vCreatedFrom - AND ic.merchandise != FALSE; - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vSaleFk; - - IF v_done THEN - LEAVE l; - END IF; - - SELECT ticketFk, concept - INTO vTicketFk, vConcept - FROM sale - WHERE id = vSaleFk; - - CALL sale_calculateComponent(vSaleFk, 'renewPrices'); - END LOOP; - - CLOSE vCur; - DROP TEMPORARY TABLE tmp.coste; -END$$ -DELIMITER ;