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-2645: task is complete. #337

Merged
merged 7 commits into from
Nov 4, 2024
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
Binary file added api/src/main/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public enum FieldName {
SCHOOL_OF_RECORD,
SCHOOL_OF_RECORD_ID,
GRAD_PROGRAM,
ADULT_START_DATE,
SLP_DATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

public enum FieldType {
STRING,
DATE
DATE,
GUID
}
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 @@ -24,6 +24,7 @@ public class GraduationStudentRecord extends BaseModel{
private String recalculateGradStatus;
private String recalculateProjectedGrad;
private String schoolOfRecord;
private UUID schoolOfRecordId;
private String studentGrade;
private String studentStatus;
private UUID studentID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Slf4j
@Data
Expand All @@ -14,6 +15,7 @@ public class StudentCommonDTO extends StudentDemographicDTO {
private String program;
private String gradDate;
private String schoolOfRecord;
private UUID schoolOfRecordId;
private String schoolAtGrad;
private String studentGrade;
private String studentStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class StudentGradDTO extends StudentCommonDTO {
private String newProgram;
private String newGradDate;
private String newSchoolOfRecord;
private UUID newSchoolOfRecordId;
private String newStudentGrade;
private String newStudentStatus;
private String newCitizenship;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;

@Data
@Builder
@AllArgsConstructor
Expand All @@ -20,6 +22,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 @@ -182,6 +182,7 @@ private void convertStudentData(ConvGradStudent student, Student penStudent, Gra
gradStudent.setSchoolAtGrad(null);

gradStudent.setSchoolOfRecord(StringUtils.isNotBlank(student.getSchoolOfRecord())? student.getSchoolOfRecord() : null);
gradStudent.setSchoolOfRecordId(student.getSchoolOfRecordId());
gradStudent.setStudentGrade(student.getStudentGrade());
gradStudent.setStudentStatus(getGradStudentStatus(student.getStudentStatus(), student.getArchiveFlag()));

Expand Down Expand Up @@ -373,6 +374,7 @@ public StudentGradDTO loadStudentData(String pen, String accessToken) {
studentData.setStudentGrade(gradStudent.getStudentGrade());
studentData.setStudentStatus(gradStudent.getStudentStatus());
studentData.setSchoolOfRecord(gradStudent.getSchoolOfRecord());
studentData.setSchoolOfRecordId(gradStudent.getSchoolOfRecordId());
studentData.setSchoolAtGrad(gradStudent.getSchoolAtGrad());
studentData.setCitizenship(gradStudent.getStudentCitizenship());
studentData.setAdultStartDate(gradStudent.getAdultStartDate());
Expand Down Expand Up @@ -454,6 +456,13 @@ public void saveGraduationStudent(String pen, StudentGradDTO gradStudent, EventT
.build();
requestDTO.getUpdateFields().add(field);
}
// SchoolId
if (gradStudent.getNewSchoolOfRecordId() != null) {
OngoingUpdateFieldDTO field = OngoingUpdateFieldDTO.builder()
.type(FieldType.GUID).name(FieldName.SCHOOL_OF_RECORD_ID).value(gradStudent.getNewSchoolOfRecordId())
.build();
requestDTO.getUpdateFields().add(field);
}
// GRAD Program
if (StringUtils.isNotBlank(gradStudent.getNewProgram())) {
OngoingUpdateFieldDTO field = OngoingUpdateFieldDTO.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.commons.lang3.time.DateUtils;

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

public abstract class StudentGraduationUpdateBaseService extends StudentBaseService {

Expand Down Expand Up @@ -86,6 +87,44 @@ protected boolean processSchoolOfRecord(StudentGradDTO currentStudent, String va
return isChanged;
}

protected boolean processSchoolOfRecordId(StudentGradDTO currentStudent, UUID value) {
boolean isChanged = false;
switch(currentStudent.getStudentStatus()) {
case STUDENT_STATUS_CURRENT -> {
// UpdData
currentStudent.setNewSchoolOfRecordId(value);
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
// TVR
currentStudent.setNewRecalculateProjectedGrad("Y");
isChanged = true;
}
case STUDENT_STATUS_ARCHIVED -> {
if (!currentStudent.isGraduated()) {
// UpdData
currentStudent.setNewSchoolOfRecordId(value);
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
isChanged = true;
}
}
case STUDENT_STATUS_TERMINATED -> {
// UpdData
currentStudent.setNewSchoolOfRecordId(value);
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
isChanged = true;
}
default -> { // MER or DEC
// UpdData
currentStudent.setNewSchoolOfRecordId(value);
// Do not set flags to Y
isChanged = true;
}
}
return isChanged;
}

protected boolean processStudentGrade(StudentGradDTO currentStudent, String value) {
boolean isChanged = false;
switch(currentStudent.getStudentStatus()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ public void processStudent(TraxGraduationUpdateDTO updateGrad, StudentGradDTO cu

log.info(" Process Student : studentID = {}, pen = {}", currentStudent.getStudentID(), updateGrad.getPen());
// Processing order is important for the first 3 fields below.
// 1. School of record
// 1.1 School of Record
if (!StringUtils.equals(updateGrad.getSchoolOfRecord(), currentStudent.getSchoolOfRecord())) {
isChanged = processSchoolOfRecord(currentStudent, updateGrad.getSchoolOfRecord());
log.info(" => school of record : current = {}, request = {}", currentStudent.getSchoolOfRecord(), currentStudent.getNewSchoolOfRecord());
}
// 1.2 School of Record Guid
if (updateGrad.getSchoolOfRecordId() != null && updateGrad.getSchoolOfRecordId() != currentStudent.getSchoolOfRecordId()) {
isChanged = processSchoolOfRecordId(currentStudent, updateGrad.getSchoolOfRecordId());
log.info(" => school of record id : current = {}, request = {}", currentStudent.getSchoolOfRecordId(), currentStudent.getNewSchoolOfRecordId());
}
// 2. Grad Program
String gradProgram = getGradProgram(updateGrad.getGraduationRequirementYear(), currentStudent.getUpToDateSchoolOfRecord(), null);
if (!StringUtils.equals(gradProgram, currentStudent.getProgram())) {
Expand Down
Loading
Loading