feat: refs #7207 show queue in worker summary #3007

Merged
jorgep merged 18 commits from 7207-showPbx into dev 2024-10-10 07:20:18 +00:00
Member
No description provided.
jorgep added 1 commit 2024-09-23 12:41:13 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
6ff76fd74b
feat: refs #7207 show queue in worker summary
jorgep added 1 commit 2024-09-24 08:15:06 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
c6a3004d12
feat: refs #7207 allocate new queue on dept change
jorgep added 1 commit 2024-09-24 12:39:03 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
0f8db9ee7e
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7207-showPbx
jorgep added 1 commit 2024-09-24 13:43:38 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
02e837ebb6
feat: refs #7207 add queue on department change
jorgep changed title from WIP: feat: refs #7207 show queue in worker summary to feat: refs #7207 show queue in worker summary 2024-09-24 13:48:05 +00:00
jorgep added 1 commit 2024-09-24 13:49:49 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
16b059a14a
refactor: refs #7207 tab
jorgep reviewed 2024-09-24 15:29:23 +00:00
@ -0,0 +19,4 @@
}
},
"relations": {
"queueRelation": {
Author
Member

Como tiene un campo llamado queue, no puedo llamar a la relación queue, no funciona.

Como tiene un campo llamado queue, no puedo llamar a la relación queue, no funciona.
jorgep added 1 commit 2024-09-25 06:59:29 +00:00
jorgep added the
CR / Tests passed
label 2024-09-25 07:11:08 +00:00
jorgep requested review from jgallego 2024-09-25 07:11:20 +00:00
jorgep added 1 commit 2024-09-25 07:18:14 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
1c42303a75
chore: refs #7207 drop useless relation
jgallego requested changes 2024-09-25 14:24:56 +00:00
Dismissed
@ -0,0 +1,36 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`queueMember_updateQueue`(
Owner
DELIMITER $$

CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`queueMember_updateQueue`(
	vBusinessFk INT
)
BEGIN
	/**
	* Elimina la entrada de la cola anterior y luego inserta la nueva para un trabajador.
	*
	* @param vBusinessFk ID del negocio
	*/
	DECLARE vNewQueue VARCHAR(10);
	DECLARE vExtension VARCHAR(10);

	-- Obtener la nueva cola y la extensión del trabajador
	SELECT d.pbxQueue, s.extension 
	INTO vNewQueue, vExtension
	FROM business b
	JOIN department d ON d.id = b.departmentFk
	JOIN pbx.sip s ON s.user_id = b.workerFk
	WHERE b.id = vBusinessFk;

	-- Eliminar cualquier entrada existente en la cola
	DELETE FROM pbx.queueMember 
	WHERE extension = vExtension COLLATE utf8_general_ci
	AND queue = vNewQueue;

	-- Insertar la nueva entrada en la cola
	INSERT INTO pbx.queueMember (queue, extension)
	VALUES (vNewQueue, vExtension);

END$$
DELIMITER ;

pon esto pero tienes que transaccionralo

``` DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`queueMember_updateQueue`( vBusinessFk INT ) BEGIN /** * Elimina la entrada de la cola anterior y luego inserta la nueva para un trabajador. * * @param vBusinessFk ID del negocio */ DECLARE vNewQueue VARCHAR(10); DECLARE vExtension VARCHAR(10); -- Obtener la nueva cola y la extensión del trabajador SELECT d.pbxQueue, s.extension INTO vNewQueue, vExtension FROM business b JOIN department d ON d.id = b.departmentFk JOIN pbx.sip s ON s.user_id = b.workerFk WHERE b.id = vBusinessFk; -- Eliminar cualquier entrada existente en la cola DELETE FROM pbx.queueMember WHERE extension = vExtension COLLATE utf8_general_ci AND queue = vNewQueue; -- Insertar la nueva entrada en la cola INSERT INTO pbx.queueMember (queue, extension) VALUES (vNewQueue, vExtension); END$$ DELIMITER ; ``` pon esto pero tienes que transaccionralo
Author
Member

Este script falla cuando no existe una cola para el nuevo departamento.

Además, no elimina el registro con la cola anterior:
image

Este script falla cuando no existe una cola para el nuevo departamento. Además, no elimina el registro con la cola anterior: ![image](/attachments/0a53872c-9447-4d5d-8ebf-0731352368c7)
Author
Member

Creo que así funciona ya bien:

DELIMITER $$

CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`queueMember_updateQueue`(
	vBusinessFk INT
)
BEGIN
	/**
	* Elimina la entrada de la cola anterior y luego inserta la nueva para un trabajador.
	*
	* @param vBusinessFk ID del negocio
	*/
	DECLARE vNewQueue VARCHAR(10);
	DECLARE vExtension VARCHAR(10);
	DECLARE vPrevQueue VARCHAR(10);

	SELECT d.pbxQueue, s.extension, qm.queue
		INTO vNewQueue, vExtension, vPrevQueue
		FROM business b
			JOIN department d ON d.id = b.departmentFk
			JOIN pbx.sip s ON s.user_id = b.workerFk
			LEFT JOIN pbx.queueMember qm ON qm.extension = s.extension
	WHERE b.id = vBusinessFk;

	DELETE FROM pbx.queueMember 
		WHERE extension = vExtension COLLATE utf8_general_ci;

	INSERT IGNORE INTO pbx.queueMember (queue, extension)
		VALUES (vNewQueue, vExtension);
END$$
DELIMITER ;
Creo que así funciona ya bien: ``` DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`queueMember_updateQueue`( vBusinessFk INT ) BEGIN /** * Elimina la entrada de la cola anterior y luego inserta la nueva para un trabajador. * * @param vBusinessFk ID del negocio */ DECLARE vNewQueue VARCHAR(10); DECLARE vExtension VARCHAR(10); DECLARE vPrevQueue VARCHAR(10); SELECT d.pbxQueue, s.extension, qm.queue INTO vNewQueue, vExtension, vPrevQueue FROM business b JOIN department d ON d.id = b.departmentFk JOIN pbx.sip s ON s.user_id = b.workerFk LEFT JOIN pbx.queueMember qm ON qm.extension = s.extension WHERE b.id = vBusinessFk; DELETE FROM pbx.queueMember WHERE extension = vExtension COLLATE utf8_general_ci; INSERT IGNORE INTO pbx.queueMember (queue, extension) VALUES (vNewQueue, vExtension); END$$ DELIMITER ; ```
jorgep added 1 commit 2024-10-03 13:39:50 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
23d2d2b1ea
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7207-showPbx
jorgep added 1 commit 2024-10-03 14:50:38 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
3638e9abb6
refactor: refs #7207 simplify code
jorgep requested review from jgallego 2024-10-03 14:51:23 +00:00
jorgep added 1 commit 2024-10-04 07:46:20 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
70a2189e30
Merge branch 'dev' into 7207-showPbx
jorgep added 1 commit 2024-10-04 11:45:25 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
e1133bcc07
Merge branch 'dev' into 7207-showPbx
jgallego requested changes 2024-10-04 13:18:52 +00:00
Dismissed
@ -0,0 +18,4 @@
FROM business b
JOIN department d ON d.id = b.departmentFk
JOIN pbx.sip s ON s.user_id = b.workerFk
LEFT JOIN pbx.queueMember qm ON qm.extension = s.extension
Owner

quitar left y variable prev

quitar left y variable prev
@ -0,0 +26,4 @@
INSERT IGNORE INTO pbx.queueMember (queue, extension)
VALUES (vNewQueue, vExtension);
END$$
Owner

transaccion

transaccion
jorgep added 1 commit 2024-10-04 14:37:18 +00:00
jorgep added 1 commit 2024-10-04 14:48:42 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
e0d0b66963
feat: refs #7207 add transaction
jgallego approved these changes 2024-10-07 05:48:02 +00:00
jorgep added 1 commit 2024-10-07 06:31:16 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
53f590af61
Merge branch 'dev' into 7207-showPbx
jorgep added 1 commit 2024-10-07 14:27:13 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
3755c5a15b
Merge branch 'dev' into 7207-showPbx
jorgep added 1 commit 2024-10-07 15:45:12 +00:00
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
ebe763dc9b
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7207-showPbx
jorgep added 1 commit 2024-10-07 15:50:39 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
330c1f3de6
chore: refs #7207 drop transaction
jorgep added 1 commit 2024-10-10 07:18:10 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
f5a43962fd
Merge branch 'dev' into 7207-showPbx
jorgep merged commit 9a7aa315e5 into dev 2024-10-10 07:20:18 +00:00
jorgep deleted branch 7207-showPbx 2024-10-10 07:20:18 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: verdnatura/salix#3007
No description provided.