fix: refs #7213 componentLack y setRisk #2820

Merged
carlosap merged 2 commits from 7213-Hotfix-calculo-problemas into master 2024-07-31 14:05:33 +00:00
3 changed files with 4 additions and 4 deletions
Showing only changes of commit 77fa4dd497 - Show all commits

View File

@ -14,7 +14,7 @@ BEGIN
ENGINE = MEMORY ENGINE = MEMORY
SELECT vSelf saleFk, SELECT vSelf saleFk,
sale_hasComponentLack(vSelf) hasProblem, sale_hasComponentLack(vSelf) hasProblem,
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded (ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
FROM sale FROM sale
WHERE id = vSelf; WHERE id = vSelf;

View File

@ -14,9 +14,9 @@ BEGIN
ENGINE = MEMORY ENGINE = MEMORY
SELECT saleFk, SELECT saleFk,
sale_hasComponentLack(saleFk) hasProblem, sale_hasComponentLack(saleFk) hasProblem,
ticket_isProblemCalcNeeded(ticketFk) isProblemCalcNeeded (ticket_isProblemCalcNeeded(ticketFk) AND quantity > 0) isProblemCalcNeeded
FROM ( FROM (
SELECT s.id saleFk, s.ticketFk SELECT s.id saleFk, s.ticketFk, s.quantity
FROM ticket t FROM ticket t
JOIN sale s ON s.ticketFk = t.id JOIN sale s ON s.ticketFk = t.id
LEFT JOIN saleComponent sc ON sc.saleFk = s.id LEFT JOIN saleComponent sc ON sc.saleFk = s.id

View File

@ -85,7 +85,7 @@ BEGIN
UPDATE ticket t UPDATE ticket t
JOIN tTicketRisk tr ON tr.ticketFk = t.id JOIN tTicketRisk tr ON tr.ticketFk = t.id
SET t.risk = NULL SET t.risk = NULL
WHERE tr.isProblemCalcNeeded WHERE NOT tr.isProblemCalcNeeded
ORDER BY t.id; ORDER BY t.id;
DROP TEMPORARY TABLE tTicketRisk; DROP TEMPORARY TABLE tTicketRisk;