Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAD2-2758 #531

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ public ReportData prepareTranscriptData(ca.bc.gov.educ.api.graduation.model.dto.
try {
School schoolAtGrad = getSchoolAtGradData(graduationDataStatus, accessToken, exception);
School schoolOfRecord = getSchoolData(graduationDataStatus.getSchool());
//GRAD2-1847
//--> Revert code back to school of record GRAD2-2758
/**
SchoolTrax traxSchool = null;
if(schoolAtGrad != null) {
String mincode = schoolAtGrad.getMincode();
traxSchool = schoolService.getTraxSchoolDetails(mincode, accessToken, exception);
}
} **/
SchoolTrax traxSchool = schoolService.getTraxSchoolDetails(schoolOfRecord.getMincode(), accessToken, exception);
//<--
GraduationStatus graduationStatus = getGraduationStatus(graduationDataStatus, schoolAtGrad, schoolOfRecord);
GraduationData graduationData = getGraduationData(graduationDataStatus, gradResponse, accessToken);
graduationStatus.setProgramCompletionDate(EducGraduationApiUtils.getSimpleDateFormat(graduationData.getGraduationDate()));
Expand Down Expand Up @@ -825,7 +828,10 @@ private GraduationStatus getGraduationStatus(ca.bc.gov.educ.api.graduation.model
if (schoolAtGrad != null
&& schoolOfRecord != null
&& !StringUtils.equalsIgnoreCase(schoolOfRecord.getMincode(), schoolAtGrad.getMincode())) {
gradMessage = StringUtils.replace(gradMessage, schoolOfRecord.getName(), schoolAtGrad.getName());
//--> Revert code back to school of record GRAD2-2758
/** gradMessage = StringUtils.replace(gradMessage, schoolOfRecord.getName(), schoolAtGrad.getName());**/
//<--
log.debug("Replace school of record {} to school at graduation {}", schoolOfRecord.getName(), schoolAtGrad.getName());
}
gradStatus.setGraduationMessage(gradMessage);
return gradStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,24 @@ public Integer createAndStoreSchoolDistrictYearEndReports(String accessToken, St
if(schools != null && !schools.isEmpty()) {
boolean isDistrictSchool = schools.get(0).length() == 3;
if(isDistrictSchool) {
//--> Revert code back to school of record GRAD2-2758
/**
reportGradStudentDataList.removeIf(st -> ((StringUtils.isBlank(st.getMincodeAtGrad()) || StringUtils.equals(st.getMincode(), st.getMincodeAtGrad())) && !schools.contains(StringUtils.substring(st.getMincode(), 0, 3))));
reportGradStudentDataList.removeIf(st -> ((StringUtils.isNotBlank(st.getMincodeAtGrad()) && !StringUtils.equals(st.getMincode(), st.getMincodeAtGrad())) && !schools.contains(StringUtils.substring(st.getMincodeAtGrad(), 0, 3))));
**/
reportGradStudentDataList.removeIf(st->schools != null && !schools.isEmpty() && !schools.contains(StringUtils.substring(st.getMincode(), 0, 3)));
//<--

}
boolean isSchoolSchool = schools.get(0).length() > 3;
if(isSchoolSchool) {
//--> Revert code back to school of record GRAD2-2758
/**
reportGradStudentDataList.removeIf(st -> ((StringUtils.isBlank(st.getMincodeAtGrad()) || StringUtils.equals(st.getMincode(), st.getMincodeAtGrad())) && !schools.contains(StringUtils.trimToEmpty(st.getMincode()))));
reportGradStudentDataList.removeIf(st -> ((StringUtils.isNotBlank(st.getMincodeAtGrad()) && !StringUtils.equals(st.getMincode(), st.getMincodeAtGrad())) && !schools.contains(StringUtils.trimToEmpty(st.getMincodeAtGrad()))));
**/
reportGradStudentDataList.removeIf(st->schools != null && !schools.isEmpty() && !schools.contains(st.getMincode()));
//<--
}
}
return createAndStoreReports(reportGradStudentDataList, accessToken, slrt, drt, srt, null);
Expand Down Expand Up @@ -462,7 +473,10 @@ private String getReportOrgCode(String mincode) {

private School populateDistrictObjectByReportGradStudentData(Map<School, List<School>> districtSchoolsMap, ReportGradStudentData reportGradStudentData) {
//district data, not school
String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();
//--> Revert code back to school of record GRAD2-2758
/** String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();**/
String mincode = reportGradStudentData.getMincode();
//<--
String distcode = StringUtils.substring(mincode, 0, 3);
boolean addNewDistrict = true;
School district = null;
Expand All @@ -485,7 +499,10 @@ private School populateDistrictObjectByReportGradStudentData(Map<School, List<Sc
}

private School populateSchoolObjectByReportGradStudentData(ReportGradStudentData reportGradStudentData) {
String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();
//--> Revert code back to school of record GRAD2-2758
/** String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();**/
String mincode = reportGradStudentData.getMincode();
//<--
SchoolTrax traxSchool = schoolService.getTraxSchoolDetails(mincode);
School school = new School();
school.setStudents(new ArrayList<>());
Expand All @@ -508,7 +525,10 @@ private School populateSchoolObjectByReportGradStudentData(ReportGradStudentData
}

private School populateSchoolObjectByReportGradStudentData(Map<String, School> schoolMap, ReportGradStudentData reportGradStudentData) {
String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();
//--> Revert code back to school of record GRAD2-2758
/** String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();**/
String mincode = reportGradStudentData.getMincode();
//<--
School school = schoolMap.get(mincode);
if (school == null) {
school = populateSchoolObjectByReportGradStudentData(reportGradStudentData);
Expand All @@ -519,7 +539,10 @@ private School populateSchoolObjectByReportGradStudentData(Map<String, School> s

private void processDistrictSchoolMap(List<School> schools, ReportGradStudentData reportGradStudentData) {
boolean addNewSchool = true;
String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();
//--> Revert code back to school of record GRAD2-2758
/** String mincode = StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad();**/
String mincode = reportGradStudentData.getMincode();
//<--
String distNo = StringUtils.substring(mincode, 0, 3);
for (School school : schools) {
if (StringUtils.equals(school.getMincode(), mincode)) {
Expand Down Expand Up @@ -598,7 +621,10 @@ private Student populateStudentObjectByReportGradStudentData(ReportGradStudentDa

GraduationStatus gradStatus = new GraduationStatus();
gradStatus.setProgramCompletionDate(reportGradStudentData.getProgramCompletionDate());
gradStatus.setSchoolOfRecord(StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad());
//--> Revert code back to school of record GRAD2-2758
/** gradStatus.setSchoolOfRecord(StringUtils.isBlank(reportGradStudentData.getMincodeAtGrad()) ? reportGradStudentData.getMincode() : reportGradStudentData.getMincodeAtGrad()); **/
gradStatus.setSchoolOfRecord(reportGradStudentData.getMincode());
//<--
gradStatus.setSchoolAtGrad(reportGradStudentData.getMincodeAtGrad());
gradStatus.setProgramName(reportGradStudentData.getProgramCode());
gradStatus.setCertificates(reportGradStudentData.getCertificateTypeCode());
Expand Down
Loading