Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAD2-2255 & GRAD2-2264: tasks are completed. #221

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ private ResponseEntity<byte[]> handleBinaryResponse(byte[] resultBinary, MediaTy
}

private boolean isAsyncDistribution(String runType, String activityCode) {
return ( "MER".equals(runType) && ("MONTHLYDIST".equals(activityCode) || "NONGRADDIST".equals(activityCode)) ) || "MERYER".equals(runType) || "MERSUPP".equals(runType);
return ( "MER".equals(runType) && ("MONTHLYDIST".equals(activityCode) || "NONGRADYERUN".equals(activityCode)) ) || "MERYER".equals(runType) || "MERSUPP".equals(runType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ProcessorData fire(ProcessorData processorData) {
pV = processYedrCertificatePrintRequest(distributionPrintRequest,currentSlipCount,packSlipReq,studListNonGrad,processorData,mincode,schoolCategoryCode,numberOfPdfs);
numberOfPdfs = pV.getRight();

if (!studListNonGrad.isEmpty() && NONGRADDIST.equalsIgnoreCase(processorData.getActivityCode())) {
if (!studListNonGrad.isEmpty() && NONGRADYERUN.equalsIgnoreCase(processorData.getActivityCode())) {
logger.debug("***** Create Student NonGrad {} School Reports *****", mincode);
numberOfCreatedSchoolReports += createAndSaveNonGradReport(commonSchool, studListNonGrad, mincode, educDistributionApiConstants.getStudentNonGrad());
logger.debug("***** Number of Student NonGrad School Reports Created {} *****", numberOfCreatedSchoolReports);
Expand All @@ -86,7 +86,7 @@ public ProcessorData fire(ProcessorData processorData) {
numberOfPdfs++;
}

if(!NONGRADDIST.equalsIgnoreCase(processorData.getActivityCode())) {
if(!NONGRADYERUN.equalsIgnoreCase(processorData.getActivityCode())) {
logger.debug("***** Create {} School Report *****", mincode);
List<String> mincodes = new ArrayList<>();
mincodes.add(mincode);
Expand Down Expand Up @@ -116,7 +116,7 @@ public ProcessorData fire(ProcessorData processorData) {
numberOfProcessedSchoolReports += processDistrictSchoolDistribution(batchId, mincodes, ADDRESS_LABEL_YE, null, null, null);
logger.debug("***** Number of distributed District Label reports {} *****", numberOfProcessedSchoolReports);

if(!NONGRADDIST.equalsIgnoreCase(processorData.getActivityCode())) {
if(!NONGRADYERUN.equalsIgnoreCase(processorData.getActivityCode())) {
logger.debug("***** Create and Store District Reports *****");
numberOfCreatedSchoolLabelReports += createDistrictSchoolYearEndReport(null, DISTREP_YE_SD, null, mincodes);
logger.debug("***** Number of created District Reports {} *****", numberOfCreatedSchoolLabelReports);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,19 @@ public boolean postingProcess(DistributionResponse distributionResponse) {
boolean forAllSchools = true;
List<String> districtCodes = extractDistrictCodes(distributionResponse);
List<String> mincodes = extractSchoolCodes(distributionResponse);
if(NONGRADDIST.equalsIgnoreCase(activityCode)) {
if(NONGRADYERUN.equalsIgnoreCase(activityCode)) {
if(!districtCodes.isEmpty()) {
forAllSchools = false;
createDistrictSchoolYearEndNonGradReport(null, NONGRADDISTREP_SD, null, districtCodes);
}
if(!mincodes.isEmpty()) {
forAllSchools = false;
createDistrictSchoolYearEndNonGradReport(null, null, DISTREP_YE_SC, mincodes);
}
// GRAD2-2264: removed the redundant logic of NONGRADDISTREP_SC, which is already processed in YearEndMergeProcess
if(forAllSchools) {
createDistrictSchoolYearEndNonGradReport(null, NONGRADDISTREP_SD, null);
}
numberOfPdfs += processDistrictSchoolDistribution(batchId, null, NONGRADDISTREP_SD, DISTREP_YE_SC, transmissionMode);
numberOfPdfs += processDistrictSchoolDistribution(batchId, null, NONGRADDISTREP_SD, null, transmissionMode);
return zipBatchDirectory(batchId, download, numberOfPdfs, TMP_DIR);
}
return zipBatchDirectory(batchId, download, numberOfPdfs, TMP_DIR);
return true;
}

public boolean zipBatchDirectory(Long batchId, String download, int numberOfPdfs, String pathToZip) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class EducDistributionApiUtils {
public static final String USERDISTOC = "USERDISTOC";
public static final String YEARENDDIST = "YEARENDDIST";
public static final String MONTHLYDIST = "MONTHLYDIST";
public static final String NONGRADDIST = "NONGRADDIST";
public static final String NONGRADYERUN = "NONGRADYERUN";
public static final String SUPPDIST = "SUPPDIST";
public static final String DISTREP_YE_SD = "DISTREP_YE_SD";
public static final String DISTREP_YE_SC = "DISTREP_YE_SC";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void testdistributeSchoolReports() {
assertNotNull(res);
res = testdistributeSchoolReport("MERSUPP", "DISTRUN_SUPP", "SUPPDIST");
assertNotNull(res);
res = testdistributeSchoolReport("MERYER", "DISTRUN_YE", "NONGRADDIST");
res = testdistributeSchoolReport("MERYER", "DISTRUN_YE", "NONGRADYERUN");
assertNotNull(res);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void testPostingProcess() {
when(this.responseMock.bodyToMono(byte[].class)).thenReturn(Mono.just(bytesPdf));

when(this.webClient.post()).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(educDistributionApiConstants.getSchoolDistrictYearEndNonGradReport(), "", "", "DISTREP_YE_SC"))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.uri(String.format(educDistributionApiConstants.getSchoolDistrictYearEndNonGradReport(), "", "NONGRADDISTREP_SD", ""))).thenReturn(this.requestBodyUriMock);
when(this.requestBodyUriMock.headers(any(Consumer.class))).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.contentType(any())).thenReturn(this.requestBodyMock);
when(this.requestBodyMock.body(any(BodyInserter.class))).thenReturn(this.requestHeadersMock);
Expand All @@ -261,7 +261,7 @@ public void testPostingProcess() {
var result = this.postingDistributionService.postingProcess(response);
Assert.assertTrue(result);

response.setActivityCode(NONGRADDIST);
response.setActivityCode(NONGRADYERUN);
result = this.postingDistributionService.postingProcess(response);
Assert.assertTrue(result);
}
Expand Down
Loading