Skip to content

Commit 1803803

Browse files
committed
Merge branch 'master' into feature/EDX-2603
2 parents 09c2322 + f12245a commit 1803803

File tree

4 files changed

+41
-24
lines changed

4 files changed

+41
-24
lines changed

api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/calculator/FteCalculatorUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public boolean studentPreviouslyReportedInDistrict(StudentRuleData studentRuleDa
7373
}
7474
var school = studentRuleData.getSchool();
7575
var isPublicOnlineOrContEdSchool = (school.getSchoolCategoryCode().equals(SchoolCategoryCodes.PUBLIC.getCode()) &&
76-
(school.getFacilityTypeCode().equals(FacilityTypeCodes.DIST_LEARN.getCode()) || school.getFacilityTypeCode().equals(FacilityTypeCodes.DISTONLINE.getCode()))) ||
76+
FacilityTypeCodes.getOnlineFacilityTypeCodes().contains(school.getFacilityTypeCode())) ||
7777
school.getFacilityTypeCode().equals(FacilityTypeCodes.CONT_ED.getCode());
7878
var isStudentInDistrictFundedGrade = SchoolGradeCodes.getDistrictFundingGrades().contains(studentRuleData.getSdcSchoolCollectionStudentEntity().getEnrolledGradeCode());
7979
var assignedStudentId = studentRuleData.getSdcSchoolCollectionStudentEntity().getAssignedStudentId();
@@ -114,7 +114,7 @@ public boolean studentPreviouslyReportedInIndependentAuthority(StudentRuleData s
114114
}
115115
var student = studentRuleData.getSdcSchoolCollectionStudentEntity();
116116
var school = studentRuleData.getSchool();
117-
var isIndependentOnlineSchool = school != null && SchoolCategoryCodes.INDEPENDENTS.contains(school.getSchoolCategoryCode()) && StringUtils.equals(school.getFacilityTypeCode(), FacilityTypeCodes.DIST_LEARN.getCode());
117+
var isIndependentOnlineSchool = school != null && SchoolCategoryCodes.INDEPENDENTS.contains(school.getSchoolCategoryCode()) && FacilityTypeCodes.getOnlineFacilityTypeCodes().contains(school.getFacilityTypeCode());
118118
var isStudentInDistrictFundedGrade = SchoolGradeCodes.getDistrictFundingGrades().contains(student.getEnrolledGradeCode());
119119

120120
long countAllByAssignedStudentIdAndSdcSchoolCollectionSdcSchoolCollectionIDIn = 0;

api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/constants/v1/FacilityTypeCodes.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import lombok.Getter;
44

5+
import java.util.*;
6+
57
/**
68
* The enum for school's facility type codes
79
*/
@@ -30,4 +32,11 @@ public enum FacilityTypeCodes {
3032
public static String[] getFacilityCodesWithoutOLAndCE(){
3133
return new String[]{ALT_PROGS.getCode(), JUSTB4PRO.getCode(), LONG_PRP.getCode(), POST_SEC.getCode(), SHORT_PRP.getCode(), STANDARD.getCode(), STRONG_CEN.getCode(), STRONG_OUT.getCode(), SUMMER.getCode(), YOUTH.getCode()};
3234
}
35+
36+
public static List<String> getOnlineFacilityTypeCodes() {
37+
List<String> codes = new ArrayList<>();
38+
codes.add(DIST_LEARN.getCode());
39+
codes.add(DISTONLINE.getCode());
40+
return codes;
41+
}
3342
}

api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/rules/validationrules/impl/SchoolFundingGroupGradeRangeRule.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
import ca.bc.gov.educ.studentdatacollection.api.constants.StudentValidationFieldCode;
55
import ca.bc.gov.educ.studentdatacollection.api.constants.StudentValidationIssueSeverityCode;
66
import ca.bc.gov.educ.studentdatacollection.api.constants.StudentValidationIssueTypeCode;
7+
import ca.bc.gov.educ.studentdatacollection.api.constants.v1.SchoolCategoryCodes;
78
import ca.bc.gov.educ.studentdatacollection.api.rules.ValidationBaseRule;
89
import ca.bc.gov.educ.studentdatacollection.api.service.v1.ValidationRulesService;
910
import ca.bc.gov.educ.studentdatacollection.api.struct.StudentRuleData;
11+
import ca.bc.gov.educ.studentdatacollection.api.struct.external.institute.v1.IndependentSchoolFundingGroup;
1012
import ca.bc.gov.educ.studentdatacollection.api.struct.v1.SdcSchoolCollectionStudentValidationIssue;
1113
import lombok.extern.slf4j.Slf4j;
1214
import org.springframework.core.annotation.Order;
@@ -37,7 +39,13 @@ public boolean shouldExecute(StudentRuleData studentRuleData, List<SdcSchoolColl
3739
log.debug("In shouldExecute of SchoolFundingGroupGradeRangeRule-V44: for collectionType {} and sdcSchoolCollectionStudentID :: {}" , FteCalculatorUtils.getCollectionTypeCode(studentRuleData),
3840
studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID());
3941

40-
return true;
42+
var shouldExecute = SchoolCategoryCodes.INDEPENDENTS.contains(studentRuleData.getSchool().getSchoolCategoryCode());
43+
44+
log.debug("In shouldExecute of SchoolFundingGroupGradeRangeRule-V44: Condition returned - {} for sdcSchoolCollectionStudentID :: {}" ,
45+
shouldExecute,
46+
studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID());
47+
48+
return shouldExecute;
4149
}
4250

4351
@Override
@@ -48,7 +56,7 @@ public List<SdcSchoolCollectionStudentValidationIssue> executeValidation(Student
4856
final var student = studentRuleData.getSdcSchoolCollectionStudentEntity();
4957
final String studentGrade = student.getEnrolledGradeCode();
5058
var schoolFundingGroups = validationRulesService.getSchoolFundingGroups(studentRuleData.getSchool().getSchoolId());
51-
var gradesMapped = schoolFundingGroups.stream().map(schoolFundingGroup -> schoolFundingGroup.getSchoolGradeCode()).toList();
59+
var gradesMapped = schoolFundingGroups.stream().map(IndependentSchoolFundingGroup::getSchoolGradeCode).toList();
5260

5361
if (!gradesMapped.contains(studentGrade)) {
5462
log.debug("SchoolFundingGroupGradeRangeRule-V44: School funding groups {} and grade code {} for sdcSchoolCollectionStudentID:: {}",gradesMapped, studentGrade, studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID());

api/src/test/java/ca/bc/gov/educ/studentdatacollection/api/calculator/FteCalculatorUtilsTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -676,32 +676,32 @@ void studentPreviouslyReportedInIndependentAuthority_NoSchoolIdsFound_ReturnsFal
676676

677677
@ParameterizedTest
678678
@CsvSource({
679-
"HS, true",
680-
"KH, true",
681-
"KF, true",
682-
"01, true",
683-
"02, true",
684-
"03, true",
685-
"04, true",
686-
"05, true",
687-
"06, true",
688-
"07, true",
689-
"EU, true",
690-
"08, true",
691-
"09, true",
692-
"10, false",
693-
"11, false",
694-
"12, false",
695-
"SU, false",
696-
"GA, false"
679+
"HS, true, DIST_LEARN",
680+
"KH, true, DIST_LEARN",
681+
"KF, true, DIST_LEARN",
682+
"01, true, DIST_LEARN",
683+
"02, true, DIST_LEARN",
684+
"03, true, DIST_LEARN",
685+
"04, true, DIST_LEARN",
686+
"05, true, DIST_LEARN",
687+
"06, true, DIST_LEARN",
688+
"07, true, DISTONLINE",
689+
"EU, true, DISTONLINE",
690+
"08, true, DISTONLINE",
691+
"09, true, DISTONLINE",
692+
"10, false, DISTONLINE",
693+
"11, false, DISTONLINE",
694+
"12, false, DISTONLINE",
695+
"SU, false, DISTONLINE",
696+
"GA, false, DISTONLINE"
697697
})
698-
void studentPreviouslyReportedInIndependentAuthority_GivenDifferentGrades_ReturnExpectedResult(String enrolledGradeCode, boolean expectedResult) {
698+
void studentPreviouslyReportedInIndependentAuthority_GivenDifferentGrades_ReturnExpectedResult(String enrolledGradeCode, boolean expectedResult, String facilityTypeCode) {
699699
// Given
700700
StudentRuleData sdcStudentSagaData = new StudentRuleData();
701701
SchoolTombstone schoolTombstone = new SchoolTombstone();
702702
schoolTombstone.setSchoolId(UUID.randomUUID().toString());
703703
schoolTombstone.setSchoolCategoryCode("INDEPEND");
704-
schoolTombstone.setFacilityTypeCode("DIST_LEARN");
704+
schoolTombstone.setFacilityTypeCode(facilityTypeCode);
705705
schoolTombstone.setIndependentAuthorityId("AUTH_ID");
706706
sdcStudentSagaData.setSchool(schoolTombstone);
707707
SdcSchoolCollectionStudentEntity student = new SdcSchoolCollectionStudentEntity();

0 commit comments

Comments
 (0)