Skip to content

Commit

Permalink
Merge pull request #531 from bcgov/develop/alex-GRAD2-2758
Browse files Browse the repository at this point in the history
GRAD2-2758
  • Loading branch information
arybakov-cgi authored Jun 12, 2024
2 parents 73cce04 + 07b3776 commit 3fee5c4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
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 @@ -457,7 +468,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 @@ -480,7 +494,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 @@ -503,7 +520,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 @@ -514,7 +534,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 @@ -593,7 +616,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

0 comments on commit 3fee5c4

Please sign in to comment.