Skip to content

Commit

Permalink
Fix SP error + other issues + formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlLevik committed Mar 27, 2020
1 parent 068bb4b commit ab1ab58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
14 changes: 10 additions & 4 deletions schema/routines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,8 @@ BEGIN



SELECT c.dewarId, c.code, c.containerType, c.capacity,
SELECT DISTINCT
c.containerId, c.dewarId, c.code, c.containerType, c.capacity,
c.sampleChangerLocation, c.containerStatus, c.bltimeStamp
"blTimeStamp", c.beamlineLocation, c.screenId, c.scheduleId,
c.barcode, c.imagerId, c.sessionId, c.ownerId, c.requestedImagerId,
Expand All @@ -1996,6 +1997,11 @@ BEGIN
ppc.name "processingPipelineCategoryName"
FROM BLSample bls
INNER JOIN Container c USING (containerId)
INNER JOIN Dewar USING(dewarId)
INNER JOIN Shipping s USING(shippingId)
INNER JOIN BLSession bs ON bs.proposalId = s.proposalId
INNER JOIN Session_has_Person shp ON shp.sessionId = bs.sessionId
INNER JOIN Person p ON p.personId = shp.personId
LEFT OUTER JOIN Person o ON o.personId = c.ownerId
LEFT OUTER JOIN ContainerRegistry cr USING(containerRegistryId)
LEFT OUTER JOIN ProcessingPipeline pp
Expand All @@ -2007,7 +2013,7 @@ BEGIN

ELSE

SELECT c.dewarId, c.code, c.containerType, c.capacity,
SELECT c.containerId, c.dewarId, c.code, c.containerType, c.capacity,
c.sampleChangerLocation, c.containerStatus, c.bltimeStamp
"blTimeStamp", c.beamlineLocation, c.screenId, c.scheduleId,
c.barcode, c.imagerId, c.sessionId, c.ownerId, c.requestedImagerId,
Expand Down Expand Up @@ -7954,7 +7960,7 @@ DELIMITER ;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-03-26 16:34:35
-- Dump completed on 2020-03-27 15:04:17
-- MariaDB dump 10.17 Distrib 10.4.12-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: ispyb_build
Expand Down Expand Up @@ -8000,4 +8006,4 @@ DELIMITER ;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2020-03-26 16:34:35
-- Dump completed on 2020-03-27 15:04:17
13 changes: 10 additions & 3 deletions schema/stored_programs/sp_retrieve_container_for_sample_id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ BEGIN

IF p_authLogin IS NOT NULL THEN
-- Authorise only if the person (p_authLogin) is a member of a session on
-- the proposal.
-- the proposal that the sample belongs to.

SELECT c.dewarId, c.code, c.containerType, c.capacity,
SELECT DISTINCT
c.containerId, c.dewarId, c.code, c.containerType, c.capacity,
c.sampleChangerLocation, c.containerStatus, c.bltimeStamp
"blTimeStamp", c.beamlineLocation, c.screenId, c.scheduleId,
c.barcode, c.imagerId, c.sessionId, c.ownerId, c.requestedImagerId,
Expand All @@ -27,6 +28,11 @@ BEGIN
ppc.name "processingPipelineCategoryName"
FROM BLSample bls
INNER JOIN Container c USING (containerId)
INNER JOIN Dewar USING(dewarId)
INNER JOIN Shipping s USING(shippingId)
INNER JOIN BLSession bs ON bs.proposalId = s.proposalId
INNER JOIN Session_has_Person shp ON shp.sessionId = bs.sessionId
INNER JOIN Person p ON p.personId = shp.personId
LEFT OUTER JOIN Person o ON o.personId = c.ownerId
LEFT OUTER JOIN ContainerRegistry cr USING(containerRegistryId)
LEFT OUTER JOIN ProcessingPipeline pp
Expand All @@ -38,7 +44,8 @@ BEGIN

ELSE

SELECT c.dewarId, c.code, c.containerType, c.capacity,
SELECT
c.containerId, c.dewarId, c.code, c.containerType, c.capacity,
c.sampleChangerLocation, c.containerStatus, c.bltimeStamp
"blTimeStamp", c.beamlineLocation, c.screenId, c.scheduleId,
c.barcode, c.imagerId, c.sessionId, c.ownerId, c.requestedImagerId,
Expand Down

0 comments on commit ab1ab58

Please sign in to comment.