Skip to content

Commit

Permalink
GRAD2-2253: task is complete (#413)
Browse files Browse the repository at this point in the history
* GRAD2-2240: task is completed.

GRAD2-2240: task is completed.

* GRAD2-2253: task is complete

GRAD2-2253: task is complete
  • Loading branch information
infstar authored Jul 27, 2023
1 parent be93425 commit a1ab3c6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,18 @@ protected String buildJobParametersDTO(String jobType, String studentSearchReque
String jobParamsDtoStr = null;

if (taskSelection == null) {
// Scheduled Distribution (Monthly or Yearly)
// Distribution (Monthly, Year-end, Year-end NonGrad, Supplemental)
jobParamsDtoStr = populateJobParametersDTO(jobType, null, studentSearchRequest);
} else {
switch (taskSelection) {
case URDBJ: // User Request Distribution
jobParamsDtoStr = populateJobParametersDTO(taskSelection.getValue(), taskSelectionOptionType, studentSearchRequest);
break;
case BDBJ: // Blank Distribution
jobParamsDtoStr = populateJobParametersDTOForBlankDistribution(taskSelection.getValue(), taskSelectionOptionType, studentSearchRequest);
break;
case URPDBJ: // PSI Distribution
jobParamsDtoStr = populateJobParametersDTOForPsiDistribution(taskSelection.getValue(), taskSelectionOptionType, studentSearchRequest);
break;
}
jobParamsDtoStr = switch (taskSelection) {
case URDBJ -> // User Request Distribution
populateJobParametersDTO(taskSelection.getValue(), taskSelectionOptionType, studentSearchRequest);
case BDBJ -> // Blank Distribution
populateJobParametersDTOForBlankDistribution(taskSelection.getValue(), taskSelectionOptionType, studentSearchRequest);
case URPDBJ -> // PSI Distribution
populateJobParametersDTOForPsiDistribution(taskSelection.getValue(), taskSelectionOptionType, studentSearchRequest);
default -> jobParamsDtoStr;
};
}

return jobParamsDtoStr != null? jobParamsDtoStr : studentSearchRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void process(Long batchId, String status) {

LOGGER.debug("updateBackStudentRecords are completed");
// update status for batch job history
distributionService.updateDistributionBatchJobStatus(batchId, failedCount, status, populateJobParametersDTO(jobType, null));
distributionService.updateDistributionBatchJobStatus(batchId, failedCount, status);
LOGGER.info("END - DistributionRunStatusUpdateProcessor for batchId = {}, status = {}", batchId, status);
}

Expand Down Expand Up @@ -101,11 +101,4 @@ private void handleUnprocessedErrors(Map<String, ServiceException> unprocessed)
unprocessed.forEach((k, v) -> LOGGER.error("Student with id: {} did not have distribution date updated during monthly run due to: {}", k, v.getLocalizedMessage()));
}

private String populateJobParametersDTO(String jobType, String credentialType) {
JobParametersForDistribution jobParamsDto = new JobParametersForDistribution();
jobParamsDto.setJobName(jobType);
jobParamsDto.setCredentialType(credentialType);
return jsonTransformer.marshall(jobParamsDto);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,15 @@ public void saveStudentCredentialDistribution(Long batchId, String jobType, Stud
}

@Transactional
public void updateDistributionBatchJobStatus(Long batchId, int failedCount, String status, String jobParameters) {
public void updateDistributionBatchJobStatus(Long batchId, int failedCount, String status) {
log.debug("updateDistributionBatchJobStatus - retrieve the batch job history: batchId = {}", batchId);
BatchGradAlgorithmJobHistoryEntity jobHistory = gradBatchHistoryService.getGradAlgorithmJobHistory(batchId);
jobHistory.setEndTime(new Date(System.currentTimeMillis()));
jobHistory.setStatus(status);
jobHistory.setActualStudentsProcessed(jobHistory.getExpectedStudentsProcessed() - failedCount);
jobHistory.setJobParameters(jobParameters);
log.debug("updateDistributionBatchJobStatus - save the batch job history: batchId = {}, status = {}. actual processed count = {}", batchId, status, jobHistory.getActualStudentsProcessed());
gradBatchHistoryService.saveGradAlgorithmJobHistory(jobHistory);
log.debug("updateDistributionBatchJobStatus - save the batch job history is completed!");
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void testUpdateDistributionBatchJobStatus() throws Exception {

boolean isExceptionThrown = false;
try {
distributionService.updateDistributionBatchJobStatus(batchId, 0, status, null);
distributionService.updateDistributionBatchJobStatus(batchId, 0, status);
} catch (Exception ex) {
isExceptionThrown = true;
}
Expand Down

0 comments on commit a1ab3c6

Please sign in to comment.