fix: refs #7965 UnifyProblems
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Carlos Andrés 2024-09-30 16:39:55 +02:00
parent af4d1ad513
commit bb1695eac6
2 changed files with 18 additions and 5 deletions

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) +
(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}
]}; ]};