refs #6336 feat(claimState): delete without using

This commit is contained in:
Alex Moreno 2024-03-04 14:12:56 +01:00
parent c4d5712b83
commit b761c258a1
5 changed files with 16 additions and 11 deletions

View File

@ -1819,19 +1819,16 @@ INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk
INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, `hasToNotify`)
VALUES
( 1, 'pending', 'Pendiente', 1, 1, 0),
( 2, 'managed', 'Gestionado', 72, 5, 0),
( 3, 'resolved', 'Resuelto', 72, 7, 0),
( 4, 'canceled', 'Anulado', 72, 6, 1),
( 5, 'incomplete', 'Incompleta', 1, 3, 1),
( 6, 'mana', 'Mana', 72, 4, 0),
( 7, 'lack', 'Faltas', 72, 2, 0);
( 5, 'incomplete', 'Incompleta', 1, 3, 1);
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, 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);
(2, util.VN_CURDATE(), 4, 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

View File

@ -0,0 +1,8 @@
UPDATE vn.claim c
JOIN vn.claimState cs ON cs.id = c.claimStateFk
JOIN vn.claimState ns ON ns.code = 'resolved'
SET c.claimStateFk = ns.id
WHERE cs.code IN ('managed', 'mana', 'lack', 'relocation');
DELETE FROM vn.claimState
WHERE code IN ('managed', 'mana', 'lack', 'relocation');

View File

@ -21,7 +21,7 @@ describe('Claim edit basic data path', () => {
});
it(`should edit claim state and observation fields`, async() => {
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado');
await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Resuelto');
await page.clearInput(selectors.claimBasicData.packages);
await page.write(selectors.claimBasicData.packages, '2');
await page.waitToClick(selectors.claimBasicData.saveButton);
@ -48,7 +48,7 @@ describe('Claim edit basic data path', () => {
await page.waitForSelector(selectors.claimBasicData.claimState);
const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, 'value');
expect(result).toEqual('Gestionado');
expect(result).toEqual('Resuelto');
});
it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {

View File

@ -64,7 +64,7 @@ describe('claimstate isEditable()', () => {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: claimManagerId}}};
const result = await app.models.ClaimState.isEditable(ctx, 7, options);
const result = await app.models.ClaimState.isEditable(ctx, 5, options);
expect(result).toEqual(true);

View File

@ -21,7 +21,7 @@ describe('Update Claim', () => {
clientFk: 1101,
ticketCreated: newDate,
workerFk: 18,
claimStateFk: 2,
claimStateFk: 1,
isChargedToMana: true,
responsibility: 4,
observation: 'observation'