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-2377 #252

Merged
merged 3 commits into from
Apr 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 @@ -303,9 +303,9 @@ public ResponseEntity<ApiResponseModel<SchoolReports>> saveSchoolReport(@Request
@PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT_REPORTS)
@Operation(summary = "Read All School Reports by Mincode", description = "Read All School Reports by Mincode", tags = { "Reports" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<List<SchoolReports>> getAllSchoolReportsList(@PathVariable String mincode,@RequestHeader(name="Authorization") String accessToken) {
public ResponseEntity<List<SchoolReports>> getAllSchoolReportsList(@PathVariable String mincode) {
logger.debug("getAllSchoolReportsList : ");
return response.GET(commonService.getAllSchoolReportListByMincode(mincode, accessToken.replace(BEARER,"")));
return response.GET(commonService.getAllSchoolReportListByMincode(mincode));
}

@GetMapping(EducGradReportApiConstants.SCHOOL_REPORTS_BY_REPORT_TYPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public List<GradStudentReports> getAllStudentReportList(UUID studentID) {
return reportList;
}

public List<SchoolReports> getAllSchoolReportListByMincode(String mincode, String accessToken) {
public List<SchoolReports> getAllSchoolReportListByMincode(String mincode) {
List<SchoolReports> reportList = new ArrayList<>();
if (StringUtils.isNotBlank(mincode)) {
if (StringUtils.contains(mincode, "*")) {
Expand Down Expand Up @@ -745,7 +745,12 @@ private synchronized List<ReportGradStudentData> getNextPageStudentsFromGradStud
} else {
dataResult.setCertificateTypeCode(certificateTypeCode);
}
result.add(dataResult);
if("YED4".equalsIgnoreCase(paperType) && "CUR".equalsIgnoreCase(s.getStudentStatus())) {
result.add(dataResult);
}
if (!"YED4".equalsIgnoreCase(paperType)) {
result.add(dataResult);
}
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,9 @@ public void testGetAllSchoolReportList() {
studentCertificate2.setReportTypeCode(gradCertificateType.getCode());
gradStudentReportList.add(studentCertificate2);

Mockito.when(commonService.getAllSchoolReportListByMincode(mincode,"accessToken")).thenReturn(gradStudentReportList);
commonController.getAllSchoolReportsList(mincode,"accessToken");
Mockito.verify(commonService).getAllSchoolReportListByMincode(mincode,"accessToken");
Mockito.when(commonService.getAllSchoolReportListByMincode(mincode)).thenReturn(gradStudentReportList);
commonController.getAllSchoolReportsList(mincode);
Mockito.verify(commonService).getAllSchoolReportListByMincode(mincode);

Mockito.when(commonService.getAllSchoolReportListByReportType(gradCertificateType.getCode(), mincode)).thenReturn(gradStudentReportList);
commonController.getSchoolReportsListByReportType(gradCertificateType.getCode(), mincode, "accessToken");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ public void testGetAllSchoolReportList() {
when(schoolReportsLightRepository.findByReportTypeCodeAndSchoolOfRecord(gradReportTypes.getCode(), "")).thenReturn(schoolReportsLightEntityList);
when(gradReportTypesRepository.findById(gradReportTypes.getCode())).thenReturn(Optional.of(gradReportTypesEntity));

var result = commonService.getAllSchoolReportListByMincode(mincode,"accessToken");
var result = commonService.getAllSchoolReportListByMincode(mincode);

assertThat(result).isNotNull().hasSize(2);
assertThat(result.get(0).getSchoolOfRecord()).isEqualTo(mincode2);
Expand Down Expand Up @@ -1262,7 +1262,7 @@ public void testGetAllSchoolReportList_withoutwildcard() {
when(schoolReportsRepository.findBySchoolOfRecordOrderBySchoolOfRecord("12345631231")).thenReturn(schoolReportsEntityList);
when(gradReportTypesRepository.findById(gradReportTypes.getCode())).thenReturn(Optional.of(gradReportTypesEntity));

var result = commonService.getAllSchoolReportListByMincode(mincode,"accessToken");
var result = commonService.getAllSchoolReportListByMincode(mincode);

assertThat(result).isNotNull().hasSize(2);
assertThat(result.get(0).getSchoolOfRecord()).isEqualTo(mincode2);
Expand Down
Loading