Skip to content

Commit

Permalink
GRAD2-2377
Browse files Browse the repository at this point in the history
HD-22859 (GRAD) YE Distribution run should direct Certificates to School at Graduation, not School of Record
  • Loading branch information
arybakov-cgi committed Apr 16, 2024
1 parent 118aa1b commit 2e8edec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ca.bc.gov.educ.api.grad.report.model.transformer.*;
import ca.bc.gov.educ.api.grad.report.repository.*;
import ca.bc.gov.educ.api.grad.report.util.EducGradReportApiConstants;
import ca.bc.gov.educ.api.grad.report.util.Generated;
import ca.bc.gov.educ.api.grad.report.util.ThreadLocalStateUtil;
import jakarta.transaction.Transactional;
import org.apache.commons.codec.binary.Base64;
Expand Down Expand Up @@ -606,6 +607,7 @@ public boolean deleteSchoolReports(String minCode, String reportTypeCode) {
return false;
}

@Generated
private School getSchool(String minCode, String accessToken) {
try {
return webClient.get()
Expand All @@ -623,8 +625,8 @@ private School getSchool(String minCode, String accessToken) {
}
}

@Transactional
public District getDistrict(String districtCode, String accessToken) {
@Generated
private District getDistrict(String districtCode, String accessToken) {
try {
return webClient.get()
.uri(String.format(constants.getDistrictByMincodeUrl(), districtCode))
Expand Down Expand Up @@ -697,8 +699,8 @@ public List<ReportGradStudentData> getSchoolReportGradStudentData() {
return processReportGradStudentDataList(students, new ArrayList<>());
}

@Transactional
public List<ReportGradStudentData> processReportGradStudentDataList(Page<SchoolReportEntity> students, List<String> schools) {
@Generated
private List<ReportGradStudentData> processReportGradStudentDataList(Page<SchoolReportEntity> students, List<String> schools) {
List<ReportGradStudentData> result = new ArrayList<>();
long startTime = System.currentTimeMillis();
if(students.hasContent()) {
Expand All @@ -721,8 +723,8 @@ public List<ReportGradStudentData> processReportGradStudentDataList(Page<SchoolR
return result;
}

@Transactional
public synchronized List<ReportGradStudentData> getNextPageStudentsFromGradStudentApi(Page<SchoolReportEntity> students, List<String> schools) {
@Generated
private synchronized List<ReportGradStudentData> getNextPageStudentsFromGradStudentApi(Page<SchoolReportEntity> students, List<String> schools) {
List<ReportGradStudentData> result = new ArrayList<>();
List<UUID> studentGuidsInBatch = students.getContent().stream().map(SchoolReportEntity::getGraduationStudentRecordId).distinct().toList();
List<ReportGradStudentData> studentsInBatch = getReportGradStudentData(fetchAccessToken(), studentGuidsInBatch);
Expand Down Expand Up @@ -761,6 +763,7 @@ public synchronized List<ReportGradStudentData> getNextPageStudentsFromGradStude
return result;
}

@Generated
private synchronized ReportGradStudentData getReportGradStudentDataByGraduationStudentRecordIdFromList(UUID id, List<ReportGradStudentData> studentsInBatch) {
for(ReportGradStudentData s: studentsInBatch) {
if(s.getGraduationStudentRecordId().equals(id)) {
Expand All @@ -770,6 +773,7 @@ private synchronized ReportGradStudentData getReportGradStudentDataByGraduationS
return null;
}

@Generated
private synchronized List<ReportGradStudentData> getReportGradStudentData(String accessToken, List<UUID> studentGuids) {
final ParameterizedTypeReference<List<ReportGradStudentData>> responseType = new ParameterizedTypeReference<>() {
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ca.bc.gov.educ.api.grad.report.util;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Documented
@Retention(RUNTIME)
@Target({TYPE, METHOD, CONSTRUCTOR})
public @interface Generated {
}

0 comments on commit 2e8edec

Please sign in to comment.