Skip to content

Commit

Permalink
GRAD2-2255: task is completed. (#233)
Browse files Browse the repository at this point in the history
GRAD2-2255: task is completed.
  • Loading branch information
infstar authored Aug 1, 2023
1 parent 18df823 commit e5bb912
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
public interface GradStudentTranscriptsRepository extends JpaRepository<GradStudentTranscriptsEntity, UUID> {

List<GradStudentTranscriptsEntity> findByStudentID(UUID studentID);
List<GradStudentTranscriptsEntity> findByStudentIDAndDocumentStatusCode(UUID studentID,String documentStatusCode);

List<GradStudentTranscriptsEntity> findByStudentIDAndDocumentStatusCodeNot(UUID studentID,String documentStatusCode);
Optional<GradStudentTranscriptsEntity> findByStudentIDAndTranscriptTypeCode(UUID studentID,String transcriptTypeCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,9 @@ public ResponseEntity<InputStreamResource> getStudentTranscriptByType(UUID stude

public boolean updateStudentCredential(UUID studentID, String credentialTypeCode, String paperType, String documentStatusCode, String activityCode) {
if (paperType.equalsIgnoreCase("YED4")) {
Optional<GradStudentTranscriptsEntity> optEntity = gradStudentTranscriptsRepository.findByStudentIDAndTranscriptTypeCodeAndDocumentStatusCode(studentID, credentialTypeCode, documentStatusCode);
if (optEntity.isPresent()) {
GradStudentTranscriptsEntity ent = optEntity.get();
List<GradStudentTranscriptsEntity> entityList = gradStudentTranscriptsRepository.findByStudentIDAndDocumentStatusCode(studentID, documentStatusCode);
if (entityList != null && !entityList.isEmpty()) {
GradStudentTranscriptsEntity ent = entityList.get(0);
ent.setUpdateDate(null);
ent.setUpdateUser(null);
ent.setDistributionDate(new Date());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ public void testUpdateStudentCredential() {
ent.setTranscriptTypeCode("E");
ent.setDocumentStatusCode("COMPL");

when(gradStudentTranscriptsRepository.findByStudentIDAndTranscriptTypeCodeAndDocumentStatusCode(studentId,credentialTypeCode,"COMPL")).thenReturn(Optional.of(ent));
when(gradStudentTranscriptsRepository.findByStudentIDAndDocumentStatusCode(studentId,"COMPL")).thenReturn(Arrays.asList(ent));
boolean res = commonService.updateStudentCredential(studentId,credentialTypeCode,paperType,"COMPL", activityCode);
assertThat(res).isTrue();
}
Expand Down

0 comments on commit e5bb912

Please sign in to comment.