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.hasItemLost,0)) hasItemLost,
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
JOIN ticket t ON t.id = tt.ticketFk
JOIN client c ON c.id = t.clientFk
@ -64,5 +65,20 @@ BEGIN
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
AND zc.dated = util.VN_CURDATE()
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$$
DELIMITER ;

View File

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