Skip to content

Commit

Permalink
band of res and refugee fte values
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmcdermid committed Jul 17, 2024
1 parent 0d1dd0d commit c5a846d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.stereotype.Service;

import java.io.InputStream;
import java.text.ParseException;
import java.util.*;

@Service
Expand Down Expand Up @@ -102,11 +103,20 @@ protected void setValueForGrade(HashMap<String, HeadcountChildNode> nodeMap, Ban
int runningTotalHeadcount = 0;
if (headcountsList != null) {
for (BandResidenceHeadcountResult each : headcountsList) {
String bandKey = each.getBandCode();
runningTotalFTE += Double.parseDouble(each.getFteTotal());
runningTotalHeadcount += Integer.parseInt(each.getHeadcount());
nodeMap.get(bandKey + HEADING).setValueForBand("FTE", each.getFteTotal());
nodeMap.get(bandKey + HEADING).setValueForBand("Headcount", each.getHeadcount());
try {
String bandKey = each.getBandCode();
double fteTotal = numberFormat.parse(each.getFteTotal()).doubleValue();
int headcountTotal = numberFormat.parse(each.getHeadcount()).intValue();

runningTotalFTE += fteTotal;
runningTotalHeadcount += headcountTotal;

nodeMap.get(bandKey + HEADING).setValueForBand("FTE", String.format("%.4f", fteTotal));
nodeMap.get(bandKey + HEADING).setValueForBand("Headcount", String.valueOf(headcountTotal));
} catch (ParseException e) {
log.error("Error parsing number in setValueForGrade - Band of Residence Report: " + e.getMessage());
throw new StudentDataCollectionAPIRuntimeException("Error parsing number in setValueForGrade - Band of Residence Report: " + e.getMessage());
}
}
}
nodeMap.get("allBandsHeading").setValueForBand("FTE", String.format("%.4f", runningTotalFTE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.stereotype.Service;

import java.io.InputStream;
import java.text.ParseException;
import java.util.*;

@Service
Expand Down Expand Up @@ -141,20 +142,25 @@ protected void setValueForGrade(HashMap<String, HeadcountChildNode> nodeMap, Ref
int totalELL = 0;

for (RefugeeHeadcountResult each : refugeeHeadcounts) {
String schoolKey = each.getSchoolID();
int schoolHeadcount = Integer.parseInt(each.getHeadcount());
double schoolFTE = Double.parseDouble(each.getFteTotal());
int schoolELL = Integer.parseInt(each.getEll());

totalHeadcount += schoolHeadcount;
totalFTE += schoolFTE;
totalELL += schoolELL;

HeadcountChildNode node = nodeMap.getOrDefault(schoolKey + HEADING, new HeadcountChildNode());
node.setValueForRefugee(HEADCOUNT, String.valueOf(schoolHeadcount));
node.setValueForRefugee("FTE", String.format("%.4f", schoolFTE));
node.setValueForRefugee("ELL", String.valueOf(schoolELL));
nodeMap.put(schoolKey + HEADING, node);
try {
String schoolKey = each.getSchoolID();
int schoolHeadcount = numberFormat.parse(each.getHeadcount()).intValue();
double schoolFTE = numberFormat.parse(each.getFteTotal()).doubleValue();
int schoolELL = numberFormat.parse(each.getEll()).intValue();

totalHeadcount += schoolHeadcount;
totalFTE += schoolFTE;
totalELL += schoolELL;

HeadcountChildNode node = nodeMap.getOrDefault(schoolKey + HEADING, new HeadcountChildNode());
node.setValueForRefugee(HEADCOUNT, String.valueOf(schoolHeadcount));
node.setValueForRefugee("FTE", String.format("%.4f", schoolFTE));
node.setValueForRefugee("ELL", String.valueOf(schoolELL));
nodeMap.put(schoolKey + HEADING, node);
} catch (ParseException e) {
log.error("Error parsing number in setValueForGrade - Refugee Report: " + e.getMessage());
throw new StudentDataCollectionAPIRuntimeException("Error parsing number in setValueForGrade - Refugee Report: " + e.getMessage());
}
}

HeadcountChildNode totalNode = nodeMap.getOrDefault(ALL_REFUGEE_HEADING, new HeadcountChildNode());
Expand Down

0 comments on commit c5a846d

Please sign in to comment.