Skip to content

Commit

Permalink
Revert "Grad2-3187 Certificates are now using school of graduation (#731
Browse files Browse the repository at this point in the history
)"

This reverts commit 3e6f39a.
  • Loading branch information
cditcher committed Jan 22, 2025
1 parent 3e6f39a commit 15505f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,11 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken)

String gradDate = null;
String formerStudent = "F";
GraduationStudentRecordEntity graduationStudentRecordEntity = null;
Optional<GraduationStudentRecordEntity> graduationStudentRecordEntityOptional = graduationStatusRepository.findById(UUID.fromString(gradSearchStudent.getStudentID()));
GraduationData graduationData = null;
if(graduationStudentRecordEntityOptional.isPresent()) {
graduationStudentRecordEntity = graduationStudentRecordEntityOptional.get();
GraduationStudentRecordEntity graduationStudentRecordEntity = graduationStudentRecordEntityOptional.get();
long sessionInterval = Integer.MAX_VALUE;
GraduationData graduationData = null;
if(StringUtils.isNotBlank(graduationStudentRecordEntity.getStudentGradData())) {
try {
graduationData = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).readValue(graduationStudentRecordEntity.getStudentGradData(), GraduationData.class);
Expand Down Expand Up @@ -474,16 +473,7 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken)
break;
}
}


if(graduationStudentRecordEntity == null) {
validation.addErrorAndStop("Student Id %s not found", gradSearchStudent.getStudentID());
}
School school = getSchool(graduationStudentRecordEntity.getSchoolAtGradId(), accessToken);
if(school == null) {
validation.addErrorAndStop("School with school at graduation Id %s not found", graduationStudentRecordEntity.getSchoolAtGradId());
}
String schoolMincode = (school.getMincode() != null && !school.getMincode().isEmpty() ? school.getMincode() : null);
assert schoolClob != null;
return StudentDemographic.builder()
.studentID(gradSearchStudent.getStudentID())
.pen(pen)
Expand Down Expand Up @@ -513,7 +503,7 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken)
.englishCert(englishCert)
.sccDate(sccDate)
.transcriptEligibility(gradSearchStudent.getTranscriptEligibility())
.mincode(schoolMincode)
.mincode(schoolClob.getMinCode())
.schoolCategory(schoolClob.getSchoolCategoryLegacyCode())
.schoolType("02".equalsIgnoreCase(schoolClob.getSchoolCategoryLegacyCode()) ? "02" : "")
.schoolName(schoolClob.getSchoolName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Publisher;
import ca.bc.gov.educ.api.gradstudent.messaging.jetstream.Subscriber;
import ca.bc.gov.educ.api.gradstudent.model.dto.*;
import ca.bc.gov.educ.api.gradstudent.model.dto.institute.School;
import ca.bc.gov.educ.api.gradstudent.model.dto.messaging.GradStudentRecord;
import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordEntity;
import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordView;
Expand Down Expand Up @@ -497,12 +496,13 @@ public void testStudentDemographics() {

final UUID studentID = UUID.fromString("ac339d70-7649-1a2e-8176-4a336df2204b");
final String pen = "123456789";
final String firstName = "FirstName";
final String lastName = "LastName";
final String program = "2018-EN";
final String gradStatus = "A";
final String stdGrade = "12";
final UUID schoolId = UUID.randomUUID();
final String schoolName = "Test School";
final UUID schoolAtGradID = UUID.randomUUID();

String graduationData = readFile("json/studentGradData.json");

Expand All @@ -515,7 +515,6 @@ public void testStudentDemographics() {
graduationStatusEntity.setProgram(program);
graduationStatusEntity.setProgramCompletionDate(new Date());
graduationStatusEntity.setSchoolOfRecordId(schoolId);
graduationStatusEntity.setSchoolAtGradId(schoolAtGradID);
graduationStatusEntity.setStudentGradData(graduationData);

when(this.graduationStatusRepository.findById(studentID)).thenReturn(Optional.of(graduationStatusEntity));
Expand Down Expand Up @@ -548,16 +547,6 @@ public void testStudentDemographics() {
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(certificatesType)).thenReturn(Mono.just(List.of(certificate)));

School school = new School();
school.setSchoolId(schoolId.toString());
school.setMincode("07171040");

when(this.webClient.get()).thenReturn(this.requestHeadersUriMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolBySchoolIdUrl(), graduationStatusEntity.getSchoolAtGradId(), "accessToken"))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school));

var studentDemog = graduationStatusService.getStudentDemographics(pen, "accessToken");
assertThat(studentDemog).isNotNull();

Expand Down Expand Up @@ -620,16 +609,6 @@ public void testStudentDemographics_whenCertificateType_isE() {
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(certificatesType)).thenReturn(Mono.just(List.of(certificate)));

School school = new School();
school.setSchoolId(schoolId.toString());
school.setMincode("07171040");

when(this.webClient.get()).thenReturn(this.requestHeadersUriMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolBySchoolIdUrl(), graduationStatusEntity.getSchoolAtGradId(), "accessToken"))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school));

var studentDemog = graduationStatusService.getStudentDemographics(pen, "accessToken");
assertThat(studentDemog).isNotNull();

Expand Down Expand Up @@ -692,16 +671,6 @@ public void testStudentDemographics_whenCertificateType_isF() {
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(certificatesType)).thenReturn(Mono.just(List.of(certificate)));

School school = new School();
school.setSchoolId(schoolId.toString());
school.setMincode("07171040");

when(this.webClient.get()).thenReturn(this.requestHeadersUriMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolBySchoolIdUrl(), graduationStatusEntity.getSchoolAtGradId(), "accessToken"))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(school));

var studentDemog = graduationStatusService.getStudentDemographics(pen, "accessToken");
assertThat(studentDemog).isNotNull();

Expand Down

0 comments on commit 15505f3

Please sign in to comment.