Skip to content

Commit

Permalink
Merge branch 'develop/alex-GRAD2-2817' of https://github.com/bcgov/ED…
Browse files Browse the repository at this point in the history
…UC-GRAD-STUDENT-API into develop/alex-GRAD2-2817
  • Loading branch information
arybakov-cgi committed Aug 20, 2024
2 parents ee4c49f + 6b79c6e commit cda1209
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ public ResponseEntity<List<UUID>> getStudentsForYearlyRun() {
@PreAuthorize(PermissionsConstants.UPDATE_GRADUATION_STUDENT)
@Operation(summary = "Save Student Grad Status by Student ID for projected run", description = "Save Student Grad Status by Student ID for projected run", tags = { "Student Graduation Status" })
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
public ResponseEntity<GraduationStudentRecord> saveStudentGradStatusDistributionRun(@PathVariable String studentID, @RequestParam(required = false) Long batchId,@RequestParam(required = false) String activityCode) {
public ResponseEntity<GraduationStudentRecord> saveStudentGradStatusDistributionRun(@PathVariable String studentID, @RequestParam(required = false) Long batchId, @RequestParam(required = false) String activityCode, @RequestParam(required = false) String username) {
logger.debug("Save Distribution student Grad Status for Student ID");
GraduationStudentRecord gradRecord = gradStatusService.saveStudentRecordDistributionRun(UUID.fromString(studentID),batchId,activityCode);
GraduationStudentRecord gradRecord = gradStatusService.saveStudentRecordDistributionRun(UUID.fromString(studentID),batchId,activityCode,username);
return response.GET(gradRecord);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1219,12 +1219,12 @@ public boolean restoreGradStudentRecord(UUID studentID,boolean isGraduated) {
}

@Retry(name = "generalpostcall")
public GraduationStudentRecord saveStudentRecordDistributionRun(UUID studentID, Long batchId, String activityCode) {
public GraduationStudentRecord saveStudentRecordDistributionRun(UUID studentID, Long batchId, String activityCode, String username) {
Optional<GraduationStudentRecordEntity> gradStatusOptional = graduationStatusRepository.findById(studentID);
if (gradStatusOptional.isPresent()) {
GraduationStudentRecordEntity gradEntity = gradStatusOptional.get();
gradEntity.setUpdateUser(null);
gradEntity.setUpdateDate(null);
gradEntity.setUpdateUser(StringUtils.isNotBlank(username) && !StringUtils.equalsIgnoreCase(username, "null") ? username : null);
gradEntity.setUpdateDate(LocalDateTime.now());
gradEntity.setBatchId(batchId);
gradEntity = graduationStatusRepository.saveAndFlush(gradEntity);
historyService.createStudentHistory(gradEntity, activityCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ public void testSaveStudentRecord_DsitributionRun() {
graduationStatus.setSchoolOfRecord("12345678");
graduationStatus.setRecalculateGradStatus("Y");

Mockito.when(graduationStatusService.saveStudentRecordDistributionRun(studentID,null,"ACTIVITYCODE")).thenReturn(graduationStatus);
graduationStatusController.saveStudentGradStatusDistributionRun(studentID.toString(),null,"ACTIVITYCODE");
Mockito.verify(graduationStatusService).saveStudentRecordDistributionRun(studentID,null,"ACTIVITYCODE");
Mockito.when(graduationStatusService.saveStudentRecordDistributionRun(studentID,null,"ACTIVITYCODE", "USER")).thenReturn(graduationStatus);
graduationStatusController.saveStudentGradStatusDistributionRun(studentID.toString(),null,"ACTIVITYCODE", "USER");
Mockito.verify(graduationStatusService).saveStudentRecordDistributionRun(studentID,null,"ACTIVITYCODE", "USER");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ public void testSaveStudentRecord_DistributionRun() {
when(graduationStatusRepository.findById(studentID)).thenReturn(Optional.of(graduationStatusEntity));
when(graduationStatusRepository.saveAndFlush(graduationStatusEntity2)).thenReturn(graduationStatusEntity2);

GraduationStudentRecord res =graduationStatusService.saveStudentRecordDistributionRun(studentID, batchId, "ACTIVITYCODE");
GraduationStudentRecord res =graduationStatusService.saveStudentRecordDistributionRun(studentID, batchId, "ACTIVITYCODE", "USER");
assertThat(res).isNotNull();
}

Expand Down

0 comments on commit cda1209

Please sign in to comment.