Skip to content

Commit

Permalink
Merge pull request #461 from bcgov/feature/Grad2-2434GRADLAGStudentAu…
Browse files Browse the repository at this point in the history
…ditHstryUserNameCorrection

Grad2-2434 Archived students user name corrected
  • Loading branch information
arybakov-cgi authored Feb 1, 2024
2 parents 5dd0cea + 4162926 commit e4d6b67
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,10 @@ private void processGradStudentRecordJobHistory(JobExecution jobExecution) {

JobParameters jobParameters = jobExecution.getJobParameters();
Long batchId = jobExecution.getId();
String token = restUtils.fetchAccessToken();
String accessToken = restUtils.fetchAccessToken();
String userName = jobParameters.getString(RUN_BY);
List<UUID> studentList;
String searchRequest = jobParameters.getString(SEARCH_REQUEST, "{}");
StudentSearchRequest req = (StudentSearchRequest) jsonTransformer.unmarshall(searchRequest, StudentSearchRequest.class);
studentList = restUtils.getStudentsForSpecialGradRun(req, token);

if (!studentList.isEmpty()) {
studentList.forEach(studentID -> {
LOGGER.debug("Update back Student Record {}", studentID);
String accessToken = restUtils.fetchAccessToken();
restUtils.updateStudentGradRecordHistory(studentID, batchId, accessToken, userName);
});

}
restUtils.updateStudentGradRecordHistory(batchId, accessToken, userName);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,14 @@ public void updateStudentGradRecord(UUID studentID, Long batchId,String activity
}
}

public void updateStudentGradRecordHistory(UUID studentID, Long batchId, String accessToken, String userName) {
public void updateStudentGradRecordHistory(Long batchId, String accessToken, String userName) {
try {
if (batchId != null) {
String url = String.format(constants.getUpdateStudentRecordHistory(), batchId, userName);
this.put(url,"{}", GraduationStudentRecord.class, accessToken);
}
} catch (Exception e) {
LOGGER.error("Unable to update student record {}", studentID);
LOGGER.error("Unable to update student record");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ public void testupdateStudentGradRecordHistory() {
when(this.responseMock.onStatus(any(), any())).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(GraduationStudentRecord.class)).thenReturn(Mono.just(rec));

this.restUtils.updateStudentGradRecordHistory(studentID,batchId,accessToken, userName);
this.restUtils.updateStudentGradRecordHistory(batchId,accessToken, userName);
assertNotNull(rec);

}
Expand Down

0 comments on commit e4d6b67

Please sign in to comment.