Skip to content

Commit

Permalink
Merge pull request #349 from bcgov/feature/GRAD2-2645
Browse files Browse the repository at this point in the history
GRAD2-2645: task is complete.
  • Loading branch information
infstar authored Nov 4, 2024
2 parents 1cfbecd + fe4b73f commit 9329c19
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 473 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Date;
import java.util.List;
import java.util.UUID;

@Data
@Builder
Expand All @@ -25,6 +26,7 @@ public class ConvGradStudent {
private String honoursStanding; // inc
private String studentGradData;
private String schoolOfRecord; // inc
private UUID schoolOfRecordId; // inc
private String schoolAtGrad; // inc
private String studentGrade; // inc
private String studentStatus; // inc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;

@Data
@Builder
@AllArgsConstructor
Expand All @@ -19,6 +21,8 @@ public class TraxGraduationUpdateDTO extends TraxStudentUpdateDTO {
private String studentGrade;
// MINCODE
private String schoolOfRecord;
// SchoolId
private UUID schoolOfRecordId;
// SLP_DATE
private String slpDate;
// STUD_CITIZ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import ca.bc.gov.educ.api.trax.repository.GradCourseRepository;
import ca.bc.gov.educ.api.trax.repository.TraxStudentNoRepository;
import ca.bc.gov.educ.api.trax.repository.TraxStudentRepository;
import ca.bc.gov.educ.api.trax.service.institute.CommonService;
import ca.bc.gov.educ.api.trax.service.institute.SchoolService;
import ca.bc.gov.educ.api.trax.util.EducGradTraxApiConstants;
import ca.bc.gov.educ.api.trax.util.EducGradTraxApiUtils;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -27,7 +27,7 @@
@Slf4j
public class TraxCommonService {

private final CommonService commonSerivce;
private SchoolService schoolService;
private final TraxStudentRepository traxStudentRepository;
private final TraxStudentNoRepository traxStudentNoRepository;
private final GradCourseRepository gradCourseRepository;
Expand All @@ -38,14 +38,14 @@ public class TraxCommonService {
private final EducGradTraxApiConstants constants;

@Autowired
public TraxCommonService(CommonService commonService,
public TraxCommonService(SchoolService schoolService,
TraxStudentRepository traxStudentRepository,
TraxStudentNoRepository traxStudentNoRepository,
GradCourseRepository gradCourseRepository,
TraxStudentNoTransformer traxStudentNoTransformer,
GradCourseTransformer gradCourseTransformer,
EducGradTraxApiConstants constants) {
this.commonSerivce = commonService;
this.schoolService = schoolService;
this.traxStudentRepository = traxStudentRepository;
this.traxStudentNoRepository = traxStudentNoRepository;
this.gradCourseRepository = gradCourseRepository;
Expand Down Expand Up @@ -187,6 +187,11 @@ public TraxStudentNo deleteTraxStudentNo(String pen) {
return null;
}

public UUID getSchoolIdFromRedisCache(String mincode) {
ca.bc.gov.educ.api.trax.model.dto.institute.School school = schoolService.getSchoolByMinCodeFromRedisCache(mincode);
return school != null && StringUtils.isNotBlank(school.getSchoolId())? UUID.fromString(school.getSchoolId()) : null;
}

private List<ConvGradStudent> buildConversionGradStudents(List<Object[]> traxStudents) {
List<ConvGradStudent> students = new ArrayList<>();
traxStudents.forEach(result -> {
Expand Down Expand Up @@ -215,6 +220,8 @@ private ConvGradStudent populateConvGradStudent(Object[] fields) {
Character archiveFlag = (Character) fields[5];
String graduationRequirementYear = (String) fields[6];

UUID schoolOfRecordId = this.getSchoolIdFromRedisCache(schoolOfRecord);

// grad or non-grad
Date programCompletionDate = null;
String gradDateStr = null;
Expand Down Expand Up @@ -272,6 +279,7 @@ private ConvGradStudent populateConvGradStudent(Object[] fields) {
.slpDate(slpDateStr)
.sccDate(sccDateStr)
.schoolOfRecord(schoolOfRecord)
.schoolOfRecordId(schoolOfRecordId)
.schoolAtGrad(schoolAtGrad)
.studentGrade(studentGrade)
.studentStatus(studentStatus != null? studentStatus.toString() : null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ private TraxStudentUpdateDTO populateEventPayload(String updateType, String pen)
gradUpdate.setGraduationRequirementYear(traxStudent.getGraduationRequirementYear());
gradUpdate.setStudentGrade(traxStudent.getStudentGrade());
gradUpdate.setSchoolOfRecord(traxStudent.getSchoolOfRecord());
// TODO(jsung): implement after GRAD2-2645 is merged
// gradUpdate.setSchoolOfRecordId(commonService.getSchoolIdFromRedisCache(gradUpdate.getSchoolOfRecord()));
gradUpdate.setSchoolOfRecordId(commonService.getSchoolIdFromRedisCache(gradUpdate.getSchoolOfRecord()));
gradUpdate.setSlpDate(traxStudent.getSlpDate());
gradUpdate.setCitizenship(traxStudent.getStudentCitizenship());
gradUpdate.setStudentStatus(traxStudent.getStudentStatus());
Expand Down
Loading

0 comments on commit 9329c19

Please sign in to comment.