fix: refs #7844 salesFilter and tmp.ticket_problems.totalProblems
This commit is contained in:
parent
0c3349dc03
commit
790a44c62a
|
@ -38,7 +38,7 @@ BEGIN
|
|||
(isFreezed) +
|
||||
(hasRisk) +
|
||||
(hasTicketRequest) +
|
||||
(isTaxDataChecked) +
|
||||
(!isTaxDataChecked) +
|
||||
(hasComponentLack) +
|
||||
(itemDelay IS NOT NULL) +
|
||||
(isTooLittle) +
|
||||
|
|
|
@ -218,8 +218,8 @@ describe('SalesMonitor salesFilter()', () => {
|
|||
const firstTicket = result.shift();
|
||||
const secondTicket = result.shift();
|
||||
|
||||
expect(firstTicket.totalProblems).toEqual(4);
|
||||
expect(secondTicket.totalProblems).toEqual(4);
|
||||
expect(firstTicket.totalProblems).toEqual(3);
|
||||
expect(secondTicket.totalProblems).toEqual(3);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
|
@ -306,6 +306,12 @@ module.exports = Self => {
|
|||
stmts.push(stmt);
|
||||
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(`
|
||||
SELECT f.*, tp.*
|
||||
FROM tmp.filter f
|
||||
|
|
|
@ -158,10 +158,16 @@ module.exports = Self => {
|
|||
stmts.push(stmt);
|
||||
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(`
|
||||
SELECT f.*, tp.*
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = f.id
|
||||
FROM tmp.filter f
|
||||
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = f.id
|
||||
`);
|
||||
|
||||
if (args.problems != undefined && (!args.originDated && !args.futureDated))
|
||||
|
|
Loading…
Reference in New Issue