fix: refs #7844 salesFilter and tmp.ticket_problems.totalProblems

This commit is contained in:
Guillermo Bonet 2024-09-03 13:29:01 +02:00
parent 0c3349dc03
commit 790a44c62a
4 changed files with 17 additions and 5 deletions

View File

@ -38,7 +38,7 @@ BEGIN
(isFreezed) + (isFreezed) +
(hasRisk) + (hasRisk) +
(hasTicketRequest) + (hasTicketRequest) +
(isTaxDataChecked) + (!isTaxDataChecked) +
(hasComponentLack) + (hasComponentLack) +
(itemDelay IS NOT NULL) + (itemDelay IS NOT NULL) +
(isTooLittle) + (isTooLittle) +

View File

@ -218,8 +218,8 @@ describe('SalesMonitor salesFilter()', () => {
const firstTicket = result.shift(); const firstTicket = result.shift();
const secondTicket = result.shift(); const secondTicket = result.shift();
expect(firstTicket.totalProblems).toEqual(4); expect(firstTicket.totalProblems).toEqual(3);
expect(secondTicket.totalProblems).toEqual(4); expect(secondTicket.totalProblems).toEqual(3);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {

View File

@ -306,6 +306,12 @@ module.exports = Self => {
stmts.push(stmt); stmts.push(stmt);
stmts.push('CALL ticket_getProblems(FALSE)'); stmts.push('CALL ticket_getProblems(FALSE)');
stmt = new ParameterizedSQL(`
UPDATE tmp.ticket_problems
SET risk = IF(hasRisk AND risk > 0, risk, 0)
`);
stmts.push(stmt);
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`
SELECT f.*, tp.* SELECT f.*, tp.*
FROM tmp.filter f FROM tmp.filter f

View File

@ -158,6 +158,12 @@ module.exports = Self => {
stmts.push(stmt); stmts.push(stmt);
stmts.push('CALL ticket_getProblems(FALSE)'); stmts.push('CALL ticket_getProblems(FALSE)');
stmt = new ParameterizedSQL(`
UPDATE tmp.ticket_problems
SET risk = IF(hasRisk AND risk > 0, risk, 0)
`);
stmts.push(stmt);
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`
SELECT f.*, tp.* SELECT f.*, tp.*
FROM tmp.filter f FROM tmp.filter f