#7965 - unifyProblems #2990

Merged
jon merged 20 commits from 7965-unifyProblems into dev 2025-02-05 06:51:55 +00:00
2 changed files with 18 additions and 5 deletions
Showing only changes of commit bb1695eac6 - Show all commits

View File

@ -55,7 +55,8 @@ BEGIN
SUM(IFNULL(ts.hasItemDelay,0)) hasItemDelay, SUM(IFNULL(ts.hasItemDelay,0)) hasItemDelay,
SUM(IFNULL(ts.hasItemLost,0)) hasItemLost, SUM(IFNULL(ts.hasItemLost,0)) hasItemLost,
IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack, IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
SUM(IFNULL(ts.hasRounding,0)) hasRounding SUM(IFNULL(ts.hasRounding,0)) hasRounding,
0 totalProblems
FROM tmp.ticket tt FROM tmp.ticket tt
JOIN ticket t ON t.id = tt.ticketFk JOIN ticket t ON t.id = tt.ticketFk
JOIN client c ON c.id = t.clientFk JOIN client c ON c.id = t.clientFk
@ -64,5 +65,20 @@ BEGIN
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
AND zc.dated = util.VN_CURDATE() AND zc.dated = util.VN_CURDATE()
GROUP BY t.id; GROUP BY t.id;
UPDATE tmp.ticketProblems
SET totalProblems = (
(isFreezed) +
(hasHighRisk) +
(hasTicketRequest) +
(!isTaxDataChecked) +
(hasComponentLack) +
(hasItemDelay IS NOT NULL) +
jgallego marked this conversation as resolved Outdated

es posible que el if sobre si true es true, asignau directament no?

es posible que el if sobre si true es true, asignau directament no?
(isTooLittle) +
(hasItemLost IS NOT NULL) +
(hasRounding IS NOT NULL) +
(hasItemShortage IS NOT NULL) +
(isVip)
);
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -325,20 +325,17 @@ module.exports = Self => {
let condition; let condition;
let hasProblem; let hasProblem;
let range;
let hasWhere; let hasWhere;
switch (args.problems) { switch (args.problems) {
case true: case true:
condition = `or`; condition = `or`;
hasProblem = true; hasProblem = true;
range = {neq: null};
hasWhere = true; hasWhere = true;
break; break;
case false: case false:
condition = `and`; condition = `and`;
hasProblem = null; hasProblem = null;
range = null;
hasWhere = true; hasWhere = true;
break; break;
} }
@ -347,7 +344,7 @@ module.exports = Self => {
{'tp.isFreezed': hasProblem}, {'tp.isFreezed': hasProblem},
{'tp.hasRisk': hasProblem}, {'tp.hasRisk': hasProblem},
{'tp.hasTicketRequest': hasProblem}, {'tp.hasTicketRequest': hasProblem},
{'tp.hasItemShortage': range}, {'tp.hasItemShortage': hasProblem},
{'tp.hasRounding': hasProblem} {'tp.hasRounding': hasProblem}
]}; ]};