Skip to content

Commit

Permalink
Fix for school funding list
Browse files Browse the repository at this point in the history
  • Loading branch information
arcshiftsolutions committed Jan 9, 2025
1 parent 61bf84b commit 53cbb7a
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1389,11 +1389,65 @@ private List<String> prepareIndyAllDataForCsv(IndyFundingResult indyFundingResul
List<String> csvRowData = new ArrayList<>();
var facilityType = restUtils.getFacilityTypeCode(school.getFacilityTypeCode());

List<String> schoolFundingGroupGrades;
String groupKh;
String groupKf;
String group01;
String group02;
String group03;
String group04;
String group05;
String group06;
String group07;
String groupEU;
String group08;
String group09;
String group10;
String group11;
String group12;
String groupSU;
String groupGA;
String groupHS;

if(collection.getCollectionStatusCode().equalsIgnoreCase(CollectionStatus.COMPLETED.getCode())) {
schoolFundingGroupGrades = independentSchoolFundingGroupSnapshotService.getIndependentSchoolFundingGroupSnapshot(UUID.fromString(school.getSchoolId()), collection.getCollectionID()).stream().map(IndependentSchoolFundingGroupSnapshotEntity::getSchoolGradeCode).toList();
List<IndependentSchoolFundingGroupSnapshotEntity> schoolFundingGroups = independentSchoolFundingGroupSnapshotService.getIndependentSchoolFundingGroupSnapshot(UUID.fromString(school.getSchoolId()), collection.getCollectionID());
groupKh = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.KINDHALF.getTypeCode());
groupKf = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.KINDFULL.getTypeCode());
group01 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE01.getTypeCode());
group02 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE02.getTypeCode());
group03 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE03.getTypeCode());
group04 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE04.getTypeCode());
group05 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE05.getTypeCode());
group06 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE06.getTypeCode());
group07 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE07.getTypeCode());
groupEU = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.ELEMUNGR.getTypeCode());
group08 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE08.getTypeCode());
group09 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE09.getTypeCode());
group10 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE10.getTypeCode());
group11 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE11.getTypeCode());
group12 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE12.getTypeCode());
groupSU = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.SECONDARY_UNGRADED.getTypeCode());
groupGA = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADUATED_ADULT.getTypeCode());
groupHS = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.HOMESCHOOL.getTypeCode());
}else{
schoolFundingGroupGrades = school.getSchoolFundingGroups().stream().map(IndependentSchoolFundingGroup::getSchoolGradeCode).toList();
List<IndependentSchoolFundingGroup> schoolFundingGroups = school.getSchoolFundingGroups();
groupKh = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.KINDHALF.getTypeCode());
groupKf = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.KINDFULL.getTypeCode());
group01 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE01.getTypeCode());
group02 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE02.getTypeCode());
group03 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE03.getTypeCode());
group04 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE04.getTypeCode());
group05 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE05.getTypeCode());
group06 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE06.getTypeCode());
group07 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE07.getTypeCode());
groupEU = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.ELEMUNGR.getTypeCode());
group08 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE08.getTypeCode());
group09 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE09.getTypeCode());
group10 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE10.getTypeCode());
group11 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE11.getTypeCode());
group12 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE12.getTypeCode());
groupSU = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.SECONDARY_UNGRADED.getTypeCode());
groupGA = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADUATED_ADULT.getTypeCode());
groupHS = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.HOMESCHOOL.getTypeCode());
}

csvRowData.addAll(Arrays.asList(
Expand All @@ -1405,24 +1459,24 @@ private List<String> prepareIndyAllDataForCsv(IndyFundingResult indyFundingResul
school.getDisplayName(),
facilityType.isPresent() ? facilityType.get().getLabel() : school.getFacilityTypeCode(),

TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.KINDHALF.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.KINDFULL.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE01.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE02.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE03.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE04.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE05.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE06.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE07.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.ELEMUNGR.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE08.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE09.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE10.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE11.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE12.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.SECONDARY_UNGRADED.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADUATED_ADULT.getTypeCode()),
TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.HOMESCHOOL.getTypeCode()),
groupKh,
groupKf,
group01,
group02,
group03,
group04,
group05,
group06,
group07,
groupEU,
group08,
group09,
group10,
group11,
group12,
groupSU,
groupGA,
groupHS,

indyFundingResult.getTotalCount(),
indyFundingResult.getTotalFTE(),
Expand Down Expand Up @@ -1471,32 +1525,67 @@ private List<String> prepareIndyAllDataForCsv(IndyFundingResult indyFundingResul
private List<String> prepareIndyFundedDataForCsv(IndyFundingResult indyFundingResult, School school, District district, IndependentAuthority authority, CollectionEntity collection) {
List<String> csvRowData = new ArrayList<>();
var facilityType = restUtils.getFacilityTypeCode(school.getFacilityTypeCode());
List<String> schoolFundingGroupGrades;
String groupKh;
String groupKf;
String group01;
String group02;
String group03;
String group04;
String group05;
String group06;
String group07;
String groupEU;
String group08;
String group09;
String group10;
String group11;
String group12;
String groupSU;
String groupGA;
String groupHS;

if(collection.getCollectionStatusCode().equalsIgnoreCase(CollectionStatus.COMPLETED.getCode())) {
schoolFundingGroupGrades = independentSchoolFundingGroupSnapshotService.getIndependentSchoolFundingGroupSnapshot(UUID.fromString(school.getSchoolId()), collection.getCollectionID()).stream().map(IndependentSchoolFundingGroupSnapshotEntity::getSchoolGradeCode).toList();
List<IndependentSchoolFundingGroupSnapshotEntity> schoolFundingGroups = independentSchoolFundingGroupSnapshotService.getIndependentSchoolFundingGroupSnapshot(UUID.fromString(school.getSchoolId()), collection.getCollectionID());
groupKh = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.KINDHALF.getTypeCode());
groupKf = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.KINDFULL.getTypeCode());
group01 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE01.getTypeCode());
group02 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE02.getTypeCode());
group03 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE03.getTypeCode());
group04 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE04.getTypeCode());
group05 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE05.getTypeCode());
group06 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE06.getTypeCode());
group07 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE07.getTypeCode());
groupEU = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.ELEMUNGR.getTypeCode());
group08 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE08.getTypeCode());
group09 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE09.getTypeCode());
group10 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE10.getTypeCode());
group11 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE11.getTypeCode());
group12 = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE12.getTypeCode());
groupSU = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.SECONDARY_UNGRADED.getTypeCode());
groupGA = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.GRADUATED_ADULT.getTypeCode());
groupHS = TransformUtil.getFundingGroupSnapshotForGrade(schoolFundingGroups, SchoolGradeCodes.HOMESCHOOL.getTypeCode());
}else{
schoolFundingGroupGrades = school.getSchoolFundingGroups().stream().map(IndependentSchoolFundingGroup::getSchoolGradeCode).toList();
List<IndependentSchoolFundingGroup> schoolFundingGroups = school.getSchoolFundingGroups();
groupKh = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.KINDHALF.getTypeCode());
groupKf = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.KINDFULL.getTypeCode());
group01 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE01.getTypeCode());
group02 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE02.getTypeCode());
group03 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE03.getTypeCode());
group04 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE04.getTypeCode());
group05 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE05.getTypeCode());
group06 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE06.getTypeCode());
group07 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE07.getTypeCode());
groupEU = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.ELEMUNGR.getTypeCode());
group08 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE08.getTypeCode());
group09 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE09.getTypeCode());
group10 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE10.getTypeCode());
group11 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE11.getTypeCode());
group12 = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADE12.getTypeCode());
groupSU = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.SECONDARY_UNGRADED.getTypeCode());
groupGA = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.GRADUATED_ADULT.getTypeCode());
groupHS = TransformUtil.getFundingGroupForGrade(schoolFundingGroups, SchoolGradeCodes.HOMESCHOOL.getTypeCode());
}

var groupKh = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.KINDHALF.getTypeCode());
var groupKf = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.KINDFULL.getTypeCode());
var group01 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE01.getTypeCode());
var group02 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE02.getTypeCode());
var group03 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE03.getTypeCode());
var group04 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE04.getTypeCode());
var group05 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE05.getTypeCode());
var group06 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE06.getTypeCode());
var group07 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE07.getTypeCode());
var groupEU = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.ELEMUNGR.getTypeCode());
var group08 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE08.getTypeCode());
var group09 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE09.getTypeCode());
var group10 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE10.getTypeCode());
var group11 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE11.getTypeCode());
var group12 = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADE12.getTypeCode());
var groupSU = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.SECONDARY_UNGRADED.getTypeCode());
var groupGA = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.GRADUATED_ADULT.getTypeCode());
var groupHS = TransformUtil.getFundingGroupForGrade(schoolFundingGroupGrades, SchoolGradeCodes.HOMESCHOOL.getTypeCode());

var fteKh = TransformUtil.isSchoolFundingGroup1orGroup2(groupKh) ? indyFundingResult.getKindHFTE() : "0";
var fteKf = TransformUtil.isSchoolFundingGroup1orGroup2(groupKf) ? indyFundingResult.getKindFFTE() : "0";
var fte01 = TransformUtil.isSchoolFundingGroup1orGroup2(group01) ? indyFundingResult.getGrade1FTE() : "0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,20 @@ public static String flagCountIfNoSchoolFundingGroup(String schoolGradeCode, Lis
return value + "*";
}

public static String getFundingGroupForGrade(List<String> fundingGroups, String gradeCode) {
return fundingGroups
public static String getFundingGroupForGrade(List<IndependentSchoolFundingGroup> schoolFundingGroups, String gradeCode) {
return schoolFundingGroups
.stream()
.filter(gradeCode::equalsIgnoreCase)
.filter(group -> gradeCode.equals(group.getSchoolGradeCode()))
.map(IndependentSchoolFundingGroup::getSchoolFundingGroupCode)
.findFirst()
.orElse(null);
}

public static String getFundingGroupSnapshotForGrade(List<IndependentSchoolFundingGroupSnapshotEntity> schoolFundingGroups, String gradeCode) {
return schoolFundingGroups
.stream()
.filter(group -> gradeCode.equals(group.getSchoolGradeCode()))
.map(IndependentSchoolFundingGroupSnapshotEntity::getSchoolFundingGroupCode)
.findFirst()
.orElse(null);
}
Expand Down

0 comments on commit 53cbb7a

Please sign in to comment.