fix: refs #7844 salesFilter and tmp.ticket_problems.totalProblems
This commit is contained in:
parent
0c3349dc03
commit
790a44c62a
|
@ -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) +
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -158,10 +158,16 @@ 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
|
||||||
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = f.id
|
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = f.id
|
||||||
`);
|
`);
|
||||||
|
|
||||||
if (args.problems != undefined && (!args.originDated && !args.futureDated))
|
if (args.problems != undefined && (!args.originDated && !args.futureDated))
|
||||||
|
|
Loading…
Reference in New Issue