Skip to content

Commit

Permalink
GRAD2-2283
Browse files Browse the repository at this point in the history
Student Archive Process - Backend endpoints To COMPLETE
  • Loading branch information
arybakov-cgi committed Jul 10, 2024
1 parent 8675b41 commit 9d25143
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public interface GraduationStudentRecordRepository extends JpaRepository<Graduat
Integer countBySchoolOfRecordAmalgamated(String schoolOfRecord);

@Query("select count(*) from GraduationStudentRecordEntity c where c.schoolOfRecord IN (:schoolOfRecords) and c.studentStatus=:studentStatus")
Long countBySchoolOfRecordsAAndStudentStatus(List<String> schoolOfRecords, String studentStatus);
Long countBySchoolOfRecordsAndStudentStatus(List<String> schoolOfRecords, String studentStatus);

@Query("select count(*) from GraduationStudentRecordEntity c where c.studentStatus=:studentStatus")
Long countByStudentStatus(String studentStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ public Integer countStudentsForAmalgamatedSchoolReport(String schoolOfRecord) {

public Long countBySchoolOfRecordsAndStudentStatus(List<String> schoolOfRecords, String studentStatus) {
if(schoolOfRecords != null && !schoolOfRecords.isEmpty()) {
return graduationStatusRepository.countBySchoolOfRecordsAAndStudentStatus(schoolOfRecords, StringUtils.defaultString(studentStatus, "CUR"));
return graduationStatusRepository.countBySchoolOfRecordsAndStudentStatus(schoolOfRecords, StringUtils.defaultString(studentStatus, "CUR"));
} else {
return graduationStatusRepository.countByStudentStatus(StringUtils.defaultString(studentStatus, "CUR"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2891,6 +2891,24 @@ public void testGetStudentsCountForAmalgamatedSchoolReport() {

}

@Test
public void testCountBySchoolOfRecordsAndStudentStatus() {
Mockito.when(graduationStatusRepository.countBySchoolOfRecordsAndStudentStatus(List.of("12345678"), "CUR")).thenReturn(1L);
Long count = graduationStatusService.countBySchoolOfRecordsAndStudentStatus(List.of("12345678"), "CUR");
assertThat(count).isNotNull().isEqualTo(1L);
Mockito.when(graduationStatusRepository.countByStudentStatus("CUR")).thenReturn(2L);
count = graduationStatusService.countBySchoolOfRecordsAndStudentStatus(null, "CUR");
assertThat(count).isNotNull().isEqualTo(2L);

}

@Test
public void testArchiveStudents() {
Mockito.when(graduationStatusRepository.archiveStudents("12345678", "CUR", "ARC", 1L)).thenReturn(1);
Integer count = graduationStatusService.archiveStudents(1L, List.of("12345678"), "CUR");
assertThat(count).isNotNull().isEqualTo(1L);
}

@Test
public void testGetStudentsForAmalgamatedSchoolReport() {
List<UUID> res = amalgamatedReports("TVRNONGRAD",false);
Expand Down

0 comments on commit 9d25143

Please sign in to comment.