Skip to content

Commit

Permalink
Updating release branch for patch (#537)
Browse files Browse the repository at this point in the history
* Updated to Ubuntu 22.04

(cherry picked from commit b90fba4)

* Hotfix/alex grad2 2855 (#536)

* GRAD2-2855
P2 GRAD Incident: Not-Yet Graduated Report is Not Updated when ALL the students are graduated in the REGALG

* GRAD2-2855
P2 GRAD Incident: Not-Yet Graduated Report is Not Updated when ALL the students are graduated in the REGALG

* Update pom.xml

Updated to 1.8.59

---------

Co-authored-by: chris.ditcher <[email protected]>
Co-authored-by: Alexander Rybakov <[email protected]>
  • Loading branch information
3 people authored Jul 9, 2024
1 parent 54a94a9 commit 6450161
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ private List<GraduationStudentRecord> filterStudentList(List<GraduationStudentRe
}

private int processGradRegReport(School schoolObj, List<Student> stdList, String mincode, String accessToken, int numberOfReports) {
if(stdList != null && !stdList.isEmpty()) {
Integer studentsCount = countStudentsForAmalgamatedSchoolReport(schoolObj.getMincode());
if(studentsCount > 0) {
ReportData gradReport = getReportDataObj(schoolObj, stdList);
createAndSaveSchoolReportGradRegReport(gradReport, mincode, accessToken);
numberOfReports++;
Expand All @@ -316,14 +317,29 @@ private int processGradRegReport(School schoolObj, List<Student> stdList, String
}

private int processNonGradRegReport(School schoolObj, List<Student> stdList, String mincode, int numberOfReports) {
if(stdList != null && !stdList.isEmpty()) {
Integer studentsCount = countStudentsForAmalgamatedSchoolReport(schoolObj.getMincode());
if(studentsCount > 0) {
ReportData gradReport = getReportDataObj(schoolObj, stdList);
createAndSaveSchoolReportNonGradRegReport(gradReport, mincode);
numberOfReports++;
}
return numberOfReports;
}

private int processStudentNonGradPrjReport(School schoolObj, List<Student> stdList, String mincode, String accessToken, int numberOfReports) {
Integer studentsCount = countStudentsForAmalgamatedSchoolReport(schoolObj.getMincode());
if(studentsCount > 0) {
ReportData nongradProjected = getReportDataObj(schoolObj, stdList);
createAndSaveSchoolReportStudentNonGradPrjReport(nongradProjected, mincode, accessToken);
numberOfReports++;
}
return numberOfReports;
}

private int countStudentsForAmalgamatedSchoolReport(String mincode) {
return restService.get(String.format(educGraduationApiConstants.getGradStudentCountSchoolReport(), mincode), Integer.class);
}

private ReportData getReportDataObj(School schoolObj, List<Student> stdList) {
ReportData data = new ReportData();
schoolObj.setStudents(stdList);
Expand All @@ -333,15 +349,6 @@ private ReportData getReportDataObj(School schoolObj, List<Student> stdList) {
return data;
}

private int processStudentNonGradPrjReport(School schoolObj, List<Student> stdList, String mincode, String accessToken, int numberOfReports) {
if(stdList != null && !stdList.isEmpty()) {
ReportData nongradProjected = getReportDataObj(schoolObj, stdList);
createAndSaveSchoolReportStudentNonGradPrjReport(nongradProjected, mincode, accessToken);
numberOfReports++;
}
return numberOfReports;
}

/**
private int processStudentNonGradReport(School schoolObj, List<Student> stdList, String mincode, String accessToken, int numberOfReports) {
ReportData nongradProjected = getReportDataObj(schoolObj, stdList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class EducGraduationApiConstants {

@Value("${endpoint.grad-student-api.student-for-school-report}")
private String gradStudentListSchoolReport;

@Value("${endpoint.grad-student-api.student-count-for-school-report}")
private String gradStudentCountSchoolReport;

@Value("${endpoint.grad-student-api.read-grad-student-record}")
private String readGradStudentRecord;
Expand Down
1 change: 1 addition & 0 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ endpoint:
update-grad-status-algo-error: ${GRAD_STUDENT_API}api/v1/student/algorithmerror/%s?isGraduated=%s
update-grad-status-projected: ${GRAD_STUDENT_API}api/v1/student/projected/studentid/%s
student-for-school-report: ${GRAD_STUDENT_API}api/v1/student/batch/schoolreport/%s
student-count-for-school-report: ${GRAD_STUDENT_API}api/v1/student/amalgamated/schoolreport/%s/count
school-nongrad-year-end-students: ${GRAD_STUDENT_API}api/v1/student/studentschoolreportdata
student-nongrad-report-data: ${GRAD_STUDENT_API}api/v1/student/studentnongradreportdata
student-nongrad-report-data-mincode: ${GRAD_STUDENT_API}api/v1/student/studentnongradreportdata/%s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2035,10 +2035,12 @@ public void testCreateAndStoreSchoolReports() {
when(this.tokenUtils.getAccessToken(any())).thenReturn(Pair.of("accessToken", System.currentTimeMillis()));
when(this.tokenUtils.checkAndGetAccessToken(any())).thenReturn(Pair.of("accessToken", System.currentTimeMillis()));

when(this.restService.get(any(), any())).thenReturn(1);

Mockito.when(gradStatusService.getStudentListByMinCode(mincode, "accessToken")).thenReturn(sList);
Mockito.when(schoolService.getTraxSchoolDetails(mincode, "accessToken", exception)).thenReturn(sTrax);
int numberOfRecord = graduationService.createAndStoreSchoolReports(uniqueList,"REGALG","accessToken");
assertEquals(1,numberOfRecord);
assertEquals(2,numberOfRecord);

Mockito.when(gradStatusService.getStudentListByMinCode(mincode, "accessToken")).thenReturn(List.of());
numberOfRecord = graduationService.createAndStoreSchoolReports(uniqueList,"REGALG","accessToken");
Expand Down Expand Up @@ -2264,6 +2266,8 @@ public void testCreateAndStoreSchoolReports_TVR() {

when(this.tokenUtils.getAccessToken(any())).thenReturn(Pair.of("accessToken", System.currentTimeMillis()));

when(this.restService.get(any(), any())).thenReturn(1);

Mockito.when(gradStatusService.getStudentListByMinCode(mincode, "accessToken")).thenReturn(sList);
Mockito.when(schoolService.getTraxSchoolDetails(mincode, "accessToken", exception)).thenReturn(sTrax);
int numberOfRecord = graduationService.createAndStoreSchoolReports(uniqueList,"TVRRUN","accessToken");
Expand Down
1 change: 1 addition & 0 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ endpoint:
update-grad-status-algo-error: https://educ-grad-student-api-77c02f-test.apps.silver.devops.gov.bc.ca/api/v1/student/algorithmerror/%s?isGraduated=%s
update-grad-status-projected: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/projected/studentid/%s
student-for-school-report: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/batch/schoolreport/%s
student-count-for-school-report: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/amalgamated/schoolreport/%s/count
school-nongrad-year-end-students: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/studentschoolreportdata
student-nongrad-report-data: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/studentnongradreportdata
student-nongrad-report-data-mincode: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/studentnongradreportdata/%s
Expand Down

0 comments on commit 6450161

Please sign in to comment.