Skip to content

Commit

Permalink
Merge pull request #470 from bcgov/fix/EDX-2235
Browse files Browse the repository at this point in the history
Remove Deleted students from headcounts
  • Loading branch information
mightycox authored Feb 21, 2024
2 parents 6b7ae53 + a706b96 commit a2a1b7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"SUM(CASE WHEN s.fte > 0 THEN 1 ELSE 0 END) AS totalEligibleForFte, " +
"SUM(s.fte) AS totalFteTotal " +
"FROM SdcSchoolCollectionStudentEntity s " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
List<EnrollmentHeadcountResult> getEnrollmentHeadcountsBySchoolId(@Param("sdcSchoolCollectionID") UUID sdcSchoolCollectionID);
Expand All @@ -93,7 +94,8 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"COUNT(DISTINCT CASE WHEN ep.enrolledProgramCode IN ('08', '11', '14') AND s.frenchProgramNonEligReasonCode IS NULL THEN s.sdcSchoolCollectionStudentID END) AS totalTotals " +
"FROM SdcSchoolCollectionStudentEntity s " +
"LEFT JOIN s.sdcStudentEnrolledProgramEntities ep " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
List<FrenchHeadcountResult> getFrenchHeadcountsBySchoolId(@Param("sdcSchoolCollectionID") UUID sdcSchoolCollectionID);
Expand All @@ -104,7 +106,8 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"COUNT(DISTINCT CASE WHEN ep.enrolledProgramCode = '05' AND s.frenchProgramNonEligReasonCode IS NULL THEN 1 END) AS totalFrancophone " +
"FROM SdcSchoolCollectionStudentEntity s " +
"LEFT JOIN s.sdcStudentEnrolledProgramEntities ep " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
List<CsfFrenchHeadcountResult> getCsfFrenchHeadcountsBySchoolId(@Param("sdcSchoolCollectionID") UUID sdcSchoolCollectionID);
Expand All @@ -116,7 +119,8 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"LEFT JOIN SdcStudentEllEntity ell " +
"ON s.assignedStudentId = ell.studentID " +
"LEFT JOIN s.sdcStudentEnrolledProgramEntities ep " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionId AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionId " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
List<EllHeadcountResult> getEllHeadcountsBySchoolId(@Param("sdcSchoolCollectionId") UUID sdcSchoolCollectionId);
Expand Down Expand Up @@ -223,7 +227,8 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"COUNT(DISTINCT CASE WHEN s.careerProgramCode in ('XA', 'XB', 'XC', 'XD', 'XE', 'XF', 'XG', 'XH') AND s.careerProgramNonEligReasonCode IS NULL THEN s.sdcSchoolCollectionStudentID END) AS allTotal " +
"FROM SdcSchoolCollectionStudentEntity s " +
"LEFT JOIN s.sdcStudentEnrolledProgramEntities ep " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
List<CareerHeadcountResult> getCareerHeadcountsBySchoolId(@Param("sdcSchoolCollectionID") UUID sdcSchoolCollectionID);
Expand All @@ -236,7 +241,8 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"COUNT(DISTINCT CASE WHEN ep.enrolledProgramCode in ('29', '33', '36') AND s.indigenousSupportProgramNonEligReasonCode IS NULL THEN s.sdcSchoolCollectionStudentID END) AS allSupportProgramTotal " +
"FROM SdcSchoolCollectionStudentEntity s " +
"LEFT JOIN s.sdcStudentEnrolledProgramEntities ep " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
List<IndigenousHeadcountResult> getIndigenousHeadcountsBySchoolId(@Param("sdcSchoolCollectionID") UUID sdcSchoolCollectionID);
Expand Down Expand Up @@ -306,7 +312,7 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'R' THEN 1 END) AS specialEdRCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'K', 'P', 'Q', 'R') THEN 1 END) AS allLevels " +
"FROM SdcSchoolCollectionStudentEntity s " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode != 'ERROR' " +
"WHERE s.sdcSchoolCollection.sdcSchoolCollectionID = :sdcSchoolCollectionID AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"AND s.specialEducationNonEligReasonCode IS NULL " +
"GROUP BY s.enrolledGradeCode " +
"ORDER BY s.enrolledGradeCode")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1118,10 +1118,10 @@ void testGetSdcSchoolCollectionStudentHeadcounts_enrollmentHeadcounts() throws E
.contentType(APPLICATION_JSON))
.andDo(print())
.andExpect(jsonPath("$.headcountHeaders[0].title", equalTo("Student Headcount")))
.andExpect(jsonPath("$.headcountHeaders[0].columns.['All Students'].currentValue", equalTo("4")))
.andExpect(jsonPath("$.headcountHeaders[0].columns.['All Students'].currentValue", equalTo("2")))
.andExpect(jsonPath("$.headcountHeaders[0].columns.['All Students'].comparisonValue", equalTo("4")))
.andExpect(jsonPath("$.headcountHeaders[1].title", equalTo("Grade Headcount")))
.andExpect(jsonPath("$.headcountHeaders[1].columns.11.currentValue", equalTo("2")))
.andExpect(jsonPath("$.headcountHeaders[1].columns.11.currentValue", equalTo("1")))
.andExpect(jsonPath("$.headcountHeaders[1].columns.11.comparisonValue", equalTo("1")));

}
Expand Down

0 comments on commit a2a1b7c

Please sign in to comment.