fix: refs #8222 fix deleteZone #3239

Closed
carlossa wants to merge 6 commits from 8222-refactDeleteZone into master
4 changed files with 8 additions and 8 deletions
Showing only changes of commit 272dbd210b - Show all commits

View File

@ -240,5 +240,5 @@
"The height must be greater than 50cm": "The height must be greater than 50cm",
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first"
"There are tickets to be invoiced for this area, please delete them first": "There are tickets to be invoiced for this area, please delete them first"
carlossa marked this conversation as resolved Outdated

la clave es molt llarga, ha de ser mes curta, despues el text el pots deixar igual de llarg.
Ademés, el text this area no es intuitiu, canviau per this zone, y la traduccio seria en esa zona

la clave es molt llarga, ha de ser mes curta, despues el text el pots deixar igual de llarg. Ademés, el text this area no es intuitiu, canviau per this zone, y la traduccio seria en esa zona
}

View File

@ -383,5 +383,5 @@
"No valid travel thermograph found": "No se encontró un termógrafo válido",
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
"type cannot be blank": "Se debe rellenar el tipo",
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero"
"There are tickets to be invoiced for this area, please delete them first": "Hay tickets para esta sección, borralos primero"
}

View File

@ -51,9 +51,9 @@ module.exports = Self => {
};
const ticketList = await models.Ticket.find(filter, myOptions);
if (ticketList.length > 0)
throw new UserError('There are tickets for this area, delete them first');
const hasRefFkFilled = ticketList.some(ticket => ticket.refFk !== null && ticket.refFk !== undefined);
carlossa marked this conversation as resolved Outdated

hasRefFk suficient

hasRefFk suficient
Outdated
Review

const hasRefFk = ticketList.some(ticket => ticket.refFk)

const hasRefFk = ticketList.some(ticket => ticket.refFk)
if (hasRefFkFilled)
throw new UserError('There are tickets to be invoiced for this area, please delete them first');
await models.Zone.destroyById(id, myOptions);

View File

@ -9,7 +9,7 @@ describe('zone deletezone()', () => {
};
const ctx = {req: activeCtx};
const zoneId = 4;
const zoneId2 = 3;
const zoneId1 = 1;
carlossa marked this conversation as resolved Outdated

si sols es gasta baix, meneja els const cadascun a la seua seccio

si sols es gasta baix, meneja els const cadascun a la seua seccio
let ticketIDs;
beforeAll(async() => {
@ -51,13 +51,13 @@ describe('zone deletezone()', () => {
let error;
try {
const options = {transaction: tx};
await models.Zone.deleteZone(ctx, zoneId2, options);
await models.Zone.deleteZone(ctx, zoneId1, options);
await tx.rollback();
} catch (e) {
error = e.message;
await tx.rollback();
}
expect(error).toEqual('There are tickets for this area, delete them first');
expect(error).toEqual('There are tickets to be invoiced for this area, please delete them first');
});
});