refactor: refs #7686 remove obsolete alert level updates and adjust state alert level logic
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javi Gallego 2025-01-27 15:43:26 +01:00
parent ba2333f180
commit 857874c4c6
3 changed files with 3 additions and 16 deletions

View File

@ -1,6 +0,0 @@
UPDATE vn.alertLevel SET id = 5 WHERE id = 4;
UPDATE vn.alertLevel SET id = 4 WHERE id = 3;
UPDATE vn.alertLevel SET id = 3 WHERE id = 2;
UPDATE vn.alertLevel SET id = 2 WHERE id = 1;
INSERT INTO vn.alertLevel (code, id, hasToRecalcPrice)
VALUES ('APPROVED', 1, 1)

View File

@ -1,12 +1,5 @@
UPDATE vn.state
SET alertLevel = 1 -- APPROVED
WHERE id IN (
3, -- Ok
4 -- Impreso
);
UPDATE vn.state
SET alertLevel = 2 -- ON_PREVIOUS
SET alertLevel = 1 -- ON_PREVIOUS
WHERE id IN (
36, -- Previa Revisando
37, -- Previa Revisado

View File

@ -34,8 +34,8 @@ module.exports = Self => {
state.code == 'PICKER_DESIGNED' || state.code == 'PRINTED'
)
);
const isAllowed = isAllEditable || isSomeEditable || state.alertLevel == 0;
const alertLevel = await models.AlertLevel.findOne({where: {code: 'FREE'}}, myOptions);
const isAllowed = isAllEditable || isSomeEditable || state.alertLevel == alertLevel.id;
return isAllowed;
};
};