From fed7b0700dd8a688cf448329350f54b7879b907b Mon Sep 17 00:00:00 2001 From: Lakshmi Kolli Date: Tue, 4 May 2021 13:43:19 -0700 Subject: [PATCH] Fixed the SLA the usage math in the usage query --- sla/resources/queries/sla/ProtocolProjectsUsage.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sla/resources/queries/sla/ProtocolProjectsUsage.sql b/sla/resources/queries/sla/ProtocolProjectsUsage.sql index 88c336188..8198db54c 100644 --- a/sla/resources/queries/sla/ProtocolProjectsUsage.sql +++ b/sla/resources/queries/sla/ProtocolProjectsUsage.sql @@ -34,7 +34,7 @@ LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.pr --Ignore the gender when counting the usage if the approval data gender is: "Male or Female". Count both Male and Female usage. (SELECT i.protocol,pd.species,sum(animalsreceived) AS NumUsed FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 Where p.project = i.project AND p.objectid = pd.purchaseid AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = 'Male or Female' AND animalsreceived IS NOT NULL @@ -107,7 +107,7 @@ LEFT JOIN Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.pr -- Count only the usage for the "Male" or "Female" gender (SELECT i.protocol,pd.species,pd.gender,sum(animalsreceived) AS NumUsed FROM sla.purchasedetails pd, sla.purchase p, Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.ehr.project i, - Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals_BreedingGroups aa1 + Site.{substitutePath moduleProperty('EHR','EHRStudyContainer')}.sla.allowableAnimals aa1 Where p.project = i.project AND p.objectid = pd.purchaseid AND aa1.protocol = i.protocol AND aa1.species = pd.species AND aa1.gender = pd.gender AND aa1.gender <> 'Male or Female' AND animalsreceived IS NOT NULL