diff --git a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/calculator/FteCalculatorChainProcessor.java b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/calculator/FteCalculatorChainProcessor.java index bc9574527..a852779f3 100644 --- a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/calculator/FteCalculatorChainProcessor.java +++ b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/calculator/FteCalculatorChainProcessor.java @@ -33,7 +33,7 @@ public FteCalculationResult processFteCalculator(StudentRuleData studentRuleData String collectionType = student.getSdcSchoolCollection().getCollectionEntity().getCollectionTypeCode(); String facilityType = studentRuleData.getSchool().getFacilityTypeCode(); var onlineFacilityCodes = Arrays.asList(FacilityTypeCodes.DISTONLINE.getCode(), FacilityTypeCodes.DIST_LEARN.getCode()); - var historicalIndyStudents = validationRulesService.findIndyStudentInCurrentFiscal(studentRuleData, "8", studentRuleData.getSchool().getIndependentAuthorityId()); + var historicalStudents = validationRulesService.findStudentInCurrentFiscal(studentRuleData, "1"); for (int i = 0; i < fteCalculators.size() - 1; i++) { FteCalculator currentCalculator = fteCalculators.get(i); @@ -44,8 +44,8 @@ public FteCalculationResult processFteCalculator(StudentRuleData studentRuleData if(SchoolCategoryCodes.INDEPENDENTS.contains(studentRuleData.getSchool().getSchoolCategoryCode()) && student.getFte() != null && collectionType.equalsIgnoreCase(CollectionTypeCodes.FEBRUARY.getTypeCode()) && onlineFacilityCodes.contains(facilityType) - && (historicalIndyStudents.isEmpty() - || historicalIndyStudents.stream().noneMatch(stu -> stu.getFte().compareTo(BigDecimal.ZERO) > 0)) + && (historicalStudents.isEmpty() + || historicalStudents.stream().noneMatch(stu -> stu.getFte().compareTo(BigDecimal.ZERO) > 0)) && student.getFte().compareTo(BigDecimal.ZERO) == 0) { log.debug("ProgramEligibilityBaseRule - SpecialEducationProgramsRule: CollectionTypeCodes - {}, facilityType - {}, for sdcSchoolCollectionStudentID :: {}", collectionType, facilityType, studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID()); studentRuleData.getSdcSchoolCollectionStudentEntity().setSpecialEducationNonEligReasonCode(ProgramEligibilityIssueCode.FEB_ONLINE_WITH_HISTORICAL_FUNDING.getCode()); diff --git a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/repository/v1/SdcSchoolCollectionStudentRepository.java b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/repository/v1/SdcSchoolCollectionStudentRepository.java index 3dfb7cd6f..98bfea893 100644 --- a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/repository/v1/SdcSchoolCollectionStudentRepository.java +++ b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/repository/v1/SdcSchoolCollectionStudentRepository.java @@ -1150,11 +1150,10 @@ NOT IN (SELECT saga.sdcSchoolCollectionStudentID FROM SdcSagaEntity saga WHERE s AND SSCS.assignedStudentId in :assignedStudentIDs AND C.collectionID != :collectionID AND SSCS.sdcSchoolCollectionStudentStatusCode != 'DELETED' - AND SSC.sdcDistrictCollectionID IS null AND C.collectionID IN (SELECT CE.collectionID FROM CollectionEntity CE WHERE CE.collectionStatusCode = 'COMPLETED' AND CE.snapshotDate < :snapshotDate ORDER BY CE.snapshotDate DESC LIMIT :noOfCollections) """) - List findIndyStudentInCurrentFiscal(List assignedStudentIDs, String noOfCollections, UUID collectionID, LocalDate snapshotDate); + List findStudentInCurrentFiscal(List assignedStudentIDs, String noOfCollections, UUID collectionID, LocalDate snapshotDate); diff --git a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/rules/programelegibility/impl/SpecialEducationProgramsRule.java b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/rules/programelegibility/impl/SpecialEducationProgramsRule.java index abc4d60a1..6a639641d 100644 --- a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/rules/programelegibility/impl/SpecialEducationProgramsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/rules/programelegibility/impl/SpecialEducationProgramsRule.java @@ -55,7 +55,7 @@ public List executeValidation(StudentRuleData stude Boolean isGA = SchoolGradeCodes.GRADUATED_ADULT.getCode().equals(student.getEnrolledGradeCode()); String collectionType = student.getSdcSchoolCollection().getCollectionEntity().getCollectionTypeCode(); String facilityType = studentRuleData.getSchool().getFacilityTypeCode(); - var historicalIndyStudents = validationRulesService.findIndyStudentInCurrentFiscal(studentRuleData, "8", studentRuleData.getSchool().getIndependentAuthorityId()); + var historicalStudents = validationRulesService.findStudentInCurrentFiscal(studentRuleData, "1"); if (StringUtils.isEmpty(student.getSpecialEducationCategoryCode()) || !activeSpecialEdPrograms.contains(student.getSpecialEducationCategoryCode())) { log.debug("ProgramEligibilityBaseRule - SpecialEducationProgramsRule: Sped code value - {} for sdcSchoolCollectionStudentID :: {}", student.getSpecialEducationCategoryCode(), studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID()); @@ -71,8 +71,8 @@ public List executeValidation(StudentRuleData stude } else if(SchoolCategoryCodes.INDEPENDENTS.contains(studentRuleData.getSchool().getSchoolCategoryCode()) && student.getFte() != null && collectionType.equalsIgnoreCase(CollectionTypeCodes.FEBRUARY.getTypeCode()) && onlineFacilityCodes.contains(facilityType) && - (historicalIndyStudents.isEmpty() - || historicalIndyStudents.stream().noneMatch(stu -> stu.getFte().compareTo(BigDecimal.ZERO) > 0)) + (historicalStudents.isEmpty() + || historicalStudents.stream().noneMatch(stu -> stu.getFte().compareTo(BigDecimal.ZERO) > 0)) && student.getFte().compareTo(BigDecimal.ZERO) == 0) { log.debug("ProgramEligibilityBaseRule - SpecialEducationProgramsRule: CollectionTypeCodes - {}, facilityType - {}, for sdcSchoolCollectionStudentID :: {}", collectionType, facilityType, studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID()); errors.add(ProgramEligibilityIssueCode.FEB_ONLINE_WITH_HISTORICAL_FUNDING); diff --git a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/service/v1/ValidationRulesService.java b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/service/v1/ValidationRulesService.java index 0f46fab25..91b67d735 100644 --- a/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/service/v1/ValidationRulesService.java +++ b/api/src/main/java/ca/bc/gov/educ/studentdatacollection/api/service/v1/ValidationRulesService.java @@ -187,15 +187,10 @@ public List getStudentInHistoricalCollectionWi return sdcSchoolStudentRepository.findStudentInCurrentFiscalWithInSameDistrict(UUID.fromString(studentRuleData.getSchool().getDistrictId()), studentRuleData.getHistoricStudentIds(), noOfCollectionsForLookup, collection.getCollectionID(), collection.getSnapshotDate()); } - public List findIndyStudentInCurrentFiscal(StudentRuleData studentRuleData, String noOfCollectionsForLookup, String independentAuthorityId) { - if(independentAuthorityId != null) { - setupMergedStudentIdValues(studentRuleData); - var collection = studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollection().getCollectionEntity(); - var studentsInIndyInSept = sdcSchoolStudentRepository.findIndyStudentInCurrentFiscal(studentRuleData.getHistoricStudentIds(), noOfCollectionsForLookup, collection.getCollectionID(), collection.getSnapshotDate()); - var schoolIDs = restUtils.getSchoolIDsByIndependentAuthorityID(independentAuthorityId); - return schoolIDs.map(uuids -> studentsInIndyInSept.stream().filter(student -> uuids.contains(student.getSdcSchoolCollection().getSchoolID())).toList()).orElse(Collections.emptyList()); - } - return Collections.emptyList(); + public List findStudentInCurrentFiscal(StudentRuleData studentRuleData, String noOfCollectionsForLookup) { + setupMergedStudentIdValues(studentRuleData); + var collection = studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollection().getCollectionEntity(); + return sdcSchoolStudentRepository.findStudentInCurrentFiscal(studentRuleData.getHistoricStudentIds(), noOfCollectionsForLookup, collection.getCollectionID(), collection.getSnapshotDate()); } public List getStudentInHistoricalCollectionInAllDistrict(StudentRuleData studentRuleData) {