feat: Turn issues into calculated columns refs#7213
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
2659e3b259
commit
6d3f00ec95
|
@ -1,27 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_setRiskAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the risk for all clients with pending tickets
|
||||
*
|
||||
*/
|
||||
DECLARE vDone BOOL;
|
||||
DECLARE vClientFk INT;
|
||||
|
||||
DECLARE cClients CURSOR FOR
|
||||
SELECT id
|
||||
FROM client;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
||||
SET vDone = TRUE;
|
||||
|
||||
OPEN cClients;
|
||||
myLoop: LOOP
|
||||
SET vDone = FALSE;
|
||||
FETCH cClients INTO vClientFk;
|
||||
IF vDone THEN LEAVE myLoop; END IF;
|
||||
CALL client_setRisk(vClientFk);
|
||||
END LOOP;
|
||||
CLOSE cClients;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,17 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setFreezeProblem`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problem of tickets whose client is frozen or unfrozen
|
||||
*
|
||||
* @table tmp.ticket(ticketFk, hasProblem)
|
||||
*/
|
||||
UPDATE tmp.ticket t
|
||||
JOIN ticket ti ON ti.id = t.ticketFk
|
||||
JOIN client c ON c.id = ti.clientFk
|
||||
SET t.hasProblem = TRUE
|
||||
WHERE c.isFreezed;
|
||||
|
||||
CALL ticket_setProblem('hasTicketRequest');
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,19 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setFreezeProblemAll`()
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Update the problem of all tickets whose client is frozen or unfrozen
|
||||
*
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight();
|
||||
|
||||
CALL ticket_getFreezeProblem();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,22 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setFreezeProblemByClient`(
|
||||
vClientFk INT
|
||||
)
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Update the problem of all client tickets whose client is frozen or unfrozen
|
||||
* @param vClientFk Id client
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.clientFk = vClientFk
|
||||
AND t.shipped >= util.midnight();
|
||||
|
||||
CALL ticket_getFreezeProblem();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,29 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemFreeze`(
|
||||
vClientFk INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problem of tickets whose client is frozen or unfrozen
|
||||
*
|
||||
* @param vClientFk Id Cliente, if NULL all clients
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight()
|
||||
AND (vClientFk IS NULL OR t.clientFk = vClientFk);
|
||||
|
||||
UPDATE tmp.ticket t
|
||||
JOIN ticket ti ON ti.id = t.ticketFk
|
||||
JOIN client c ON c.id = ti.clientFk
|
||||
SET t.hasProblem = TRUE
|
||||
WHERE c.isFreezed;
|
||||
|
||||
CALL ticket_setProblem('hasTicketRequest');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,30 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRequest`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problems of tickets that have a pending ticketRequest or no longer have it
|
||||
*
|
||||
* @param vSelf Id ticket, if NULL ALL tickets
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight()
|
||||
AND (vSelf IS NULL OR t.id = vSelf);
|
||||
|
||||
|
||||
UPDATE tmp.ticket t
|
||||
JOIN ticketRequest tr ON tr.ticketFk = t.ticketFk
|
||||
SET t.hasProblem = TRUE
|
||||
WHERE tr.isOK IS NULL;
|
||||
|
||||
CALL ticket_setProblem('hasTicketRequest');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRiskProblem`(
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRisk`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRoundingProblem`(
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemRounding`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
|
@ -0,0 +1,24 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
PROCEDURE `vn`.`ticket_setProblemTaxDataChecked`(vSelf INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problem of tickets, depending on whether
|
||||
* the client taxDataCheched is verified or not
|
||||
*
|
||||
* @param vSelf Id ticket, if NULL ALL tickets
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, IF(c.isTaxDataChecked, FALSE, TRUE) hasProblem
|
||||
FROM ticket t
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.shipped >= util.midnight()
|
||||
AND (c.id = vClientFk OR vClientFk IS NULL);
|
||||
|
||||
CALL ticket_setProblem('isTaxDataChecked');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setTooLittleProblem`(
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittle`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setTooLittleProblemConfig`()
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittleConfig`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problems when the ticket is too small or is no longer so,
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setTooLittleProblemItemCost`(
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblemTooLittleItemCost`(
|
||||
vItemFk INT
|
||||
)
|
||||
BEGIN
|
|
@ -1,16 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRequestProblem`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problems of tickets that have a pending ticketRequest or no longer have it
|
||||
*
|
||||
* @table tmp.ticket(ticketFk, hasProblem)
|
||||
*/
|
||||
UPDATE tmp.ticket t
|
||||
JOIN ticketRequest tr ON tr.ticketFk = t.ticketFk
|
||||
SET t.hasProblem = TRUE
|
||||
WHERE tr.isOK IS NULL;
|
||||
|
||||
CALL ticket_setProblem('hasTicketRequest');
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,18 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRequestProblemAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problems of all tickets that have a pending ticketRequest or no longer have it
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.shipped >= util.midnight();
|
||||
|
||||
CALL ticket_getRequestProblem();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,22 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRequestProblemByTicket`(
|
||||
vSelf INT
|
||||
)
|
||||
BEGIN
|
||||
/**
|
||||
* Actualiza los problemas de un ticket que tiene una petición de compra pendiente o
|
||||
* deja de tenerla
|
||||
* @param vSelf Id del ticket de la petición de compra
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
WHERE t.id = vSelf;
|
||||
|
||||
CALL ticket_getRequestProblem();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,5 +1,5 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_setRisk`(
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRisk`(
|
||||
vSelf INT)
|
||||
BEGIN
|
||||
/**
|
|
@ -1,39 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setRiskProblemAll`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the risk problem for all tickets
|
||||
*
|
||||
*/
|
||||
CREATE OR REPLACE TEMPORARY TABLE tRisk
|
||||
(KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk,
|
||||
t.risk > (c.credit + 10) hasRisk,
|
||||
((t.risk - cc.riskTolerance) > (c.credit + 10)) hasHighRisk
|
||||
FROM client c
|
||||
JOIN ticket t ON t.clientFk = c.id
|
||||
JOIN clientConfig cc
|
||||
WHERE t.shipped >= util.midnight();
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT ticketFk, hasRisk hasProblem
|
||||
FROM tRisk;
|
||||
|
||||
CALL ticket_setProblem('hasRisk');
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp.ticket
|
||||
(KEY (ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT ticketFk, hasHighRisk hasProblem
|
||||
FROM tRisk;
|
||||
|
||||
CALL ticket_setProblem('hasHighRisk');
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
DROP TEMPORARY TABLE tRisk;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,18 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
PROCEDURE `vn`.`ticket_setTaxDataCheckedProblem`()
|
||||
BEGIN
|
||||
/**
|
||||
* Update the problem of tickets, depending on whether
|
||||
* the client taxDataCheched is verified or not
|
||||
*
|
||||
*/
|
||||
UPDATE tmp.ticket t
|
||||
JOIN ticket ti ON ti.id = t.ticketFk
|
||||
JOIN client c ON c.id = ti.clientFk
|
||||
SET ti.hasproblem = TRUE
|
||||
WHERE NOT c.isTaxDataChecked;
|
||||
|
||||
CALL ticket_setProblem('isTaxDataChecked');
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,22 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||
PROCEDURE `vn`.`ticket_setTaxDataCheckedProblemAll`()
|
||||
proc: BEGIN
|
||||
/**
|
||||
* Update the problem of all tickets, depending on whether
|
||||
* the client taxDataCheched is verified or not
|
||||
*/
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||
(INDEX(ticketFk))
|
||||
ENGINE = MEMORY
|
||||
SELECT t.id ticketFk, FALSE hasProblem
|
||||
FROM ticket t
|
||||
JOIN client c ON c.id = t.clientFk
|
||||
WHERE t.shipped >= util.midnight();
|
||||
|
||||
CALL ticket_getTaxDataCheckedProblem();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket;
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue