Skip to content

Commit

Permalink
fix: fix remaining instances of existing issue with Summary Statistic…
Browse files Browse the repository at this point in the history
…s report

OCD-4688
  • Loading branch information
tmy1313 committed Nov 14, 2024
1 parent de87f4b commit 6cf22ff
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Long getTotalSurveillanceActivities(Date endDate) {
String hql = "SELECT count(surv) "
+ "FROM SurveillanceEntity surv "
+ "JOIN surv.certifiedProduct cp "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) ";
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) ";
if (endDate == null) {
hql += " AND surv.deleted = false";
} else {
Expand Down Expand Up @@ -72,7 +72,7 @@ public Long getTotalClosedSurveillanceActivities(Date endDate) {
String hql = "SELECT count(surv) "
+ "FROM SurveillanceEntity surv "
+ "JOIN surv.certifiedProduct cp "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) "
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND surv.startDate <= local_date "
+ "AND (surv.endDate IS NOT NULL AND surv.endDate <= local_date) ";
if (endDate == null) {
Expand All @@ -96,7 +96,7 @@ public Long getTotalNonConformities(Date endDate) {
+ "JOIN surv.surveilledRequirements reqs "
+ "JOIN reqs.nonconformities nc "
+ "JOIN surv.certifiedProduct cp "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) ";
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) ";
if (endDate == null) {
hql += " AND nc.deleted = false";
} else {
Expand All @@ -118,7 +118,7 @@ public Long getTotalOpenNonconformities(Date endDate) {
+ "JOIN surv.surveilledRequirements reqs "
+ "JOIN reqs.nonconformities nc "
+ "JOIN surv.certifiedProduct cp "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) "
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND nc.nonconformityCloseDate IS NULL ";
if (endDate == null) {
hql += " AND nc.deleted = false";
Expand All @@ -143,7 +143,7 @@ public List<CertificationBodyStatistic> getTotalOpenNonconformitiesByAcb(Date en
+ "SurveillanceRequirementEntity sr, "
+ "SurveillanceNonconformityEntity sn "
+ "WHERE sn.nonconformityCloseDate IS NULL "
+ "AND cp.certificationEditionId NOT IN (:retiredEditions) "
+ "AND (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND cp.certificationBodyId = cb.id "
+ "AND cp.id = s.certifiedProductId "
+ "AND s.id = sr.surveillanceId "
Expand Down Expand Up @@ -181,7 +181,7 @@ public Long getTotalClosedNonconformities(Date endDate) {
+ "JOIN surv.surveilledRequirements reqs "
+ "JOIN reqs.nonconformities nc "
+ "JOIN surv.certifiedProduct cp "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) "
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND nc.nonconformityCloseDate IS NOT NULL ";
if (endDate == null) {
hql += " AND nc.deleted = false";
Expand All @@ -206,7 +206,7 @@ public List<CertificationBodyStatistic> getTotalOpenSurveillanceActivitiesByAcb(
+ "WHERE s.startDate <= local_date "
+ "AND (s.endDate IS NULL OR s.endDate >= local_date) "
+ "AND cp.certificationBodyId = cb.id "
+ "AND cp.certificationEditionId NOT IN (:retiredEditions) "
+ "AND (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND cp.id = s.certifiedProductId ";

if (endDate == null) {
Expand Down Expand Up @@ -241,7 +241,7 @@ public List<SurveillanceEntity> getAllSurveillancesWithNonconformities() {
+ "JOIN FETCH surv.surveilledRequirements reqs "
+ "JOIN FETCH reqs.nonconformities nc "
+ "JOIN FETCH surv.certifiedProduct cp "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) "
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND surv.deleted = false "
+ "AND reqs.deleted = false "
+ "AND nc.deleted = false ";
Expand All @@ -255,7 +255,7 @@ public List<SurveillanceEntity> getAllSurveillances() {
+ "FROM SurveillanceEntity surv "
+ "JOIN surv.certifiedProduct cp "
+ "JOIN FETCH surv.surveilledRequirements req "
+ "WHERE cp.certificationEditionId NOT IN (:retiredEditions) "
+ "WHERE (cp.certificationEditionId NOT IN (:retiredEditions) OR cp.certificationEditionId IS NULL) "
+ "AND surv.deleted = false ";
Query query = entityManager.createQuery(hql);
query.setParameter("retiredEditions", retiredEditions);
Expand Down

0 comments on commit 6cf22ff

Please sign in to comment.