Skip to content

Commit 4be7d20

Browse files
committed
SP update_container_assign: also return sample locations
1 parent 9014199 commit 4be7d20

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

schemas/ispyb/stored_programs/sp_update_container_assign.sql

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ BEGIN
2020
DECLARE row_proposalCode varchar(45) DEFAULT NULL;
2121
DECLARE row_proposalNumber varchar(45) DEFAULT NULL;
2222
DECLARE row_queuedCount int(11) unsigned DEFAULT NULL;
23+
DECLARE row_samples varchar(255) DEFAULT NULL;
2324

2425
IF p_beamline IS NULL THEN
2526
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_beamline is NULL';
@@ -50,7 +51,7 @@ BEGIN
5051
INNER JOIN ContainerRegistry cr ON c.containerRegistryId = cr.containerRegistryId
5152
INNER JOIN Dewar d ON d.dewarId = c.dewarId
5253
INNER JOIN Shipping s ON s.shippingId = d.shippingId
53-
INNER JOIN Proposal p ON p.proposalId = s.proposalId
54+
INNER JOIN Proposal p ON p.proposalId = s.proposalId
5455
LEFT OUTER JOIN ContainerQueue cq ON cq.containerId = c.containerId
5556
WHERE cr.barcode = p_registry_barcode
5657
GROUP BY c.containerId,
@@ -116,10 +117,18 @@ BEGIN
116117
ELSE
117118
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=1644, MESSAGE_TEXT='Mandatory argument p_registry_barcode is NULL';
118119
END IF;
120+
121+
SELECT group_concat(location ORDER BY cast(location AS integer) SEPARATOR ',')
122+
INTO row_samples
123+
FROM BLSample
124+
WHERE containerId = row_containerId
125+
GROUP BY containerId;
126+
119127
SELECT row_containerId as "containerId",
120128
currentContainerStatus as "containerStatus",
121129
row_proposalCode as "proposalCode",
122130
row_proposalNumber as "proposalNumber",
123-
row_queuedCount as "queuedCount";
131+
row_queuedCount as "queuedCount",
132+
row_samples as "samples";
124133
END ;;
125134
DELIMITER ;

0 commit comments

Comments
 (0)