Skip to content

Commit

Permalink
Merge pull request #339 from bcgov/grad-release
Browse files Browse the repository at this point in the history
Grad release 1.24 TEST
  • Loading branch information
githubmamatha authored Oct 3, 2024
2 parents 1c347f4 + a7f6992 commit 44f4e67
Show file tree
Hide file tree
Showing 7 changed files with 1,008 additions and 174 deletions.
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ca.bc.gov.educ</groupId>
<artifactId>educ-grad-data-conversion-api</artifactId>
<version>1.8.58</version>
<version>1.8.59</version>
<name>educ-grad-data-conversion-api</name>
<description>Ministry of Education GRAD DATA CONVERSION API</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void convertStudentData(ConvGradStudent student, Student penStudent, Gra
gradStudent.setStudentGrade(student.getStudentGrade());
gradStudent.setStudentStatus(getGradStudentStatus(student.getStudentStatus(), student.getArchiveFlag()));

handleAdultStartRule(student, penStudent, gradStudent);
handleAdultStartRule(penStudent, gradStudent);

// flags
if (StringUtils.equalsIgnoreCase(gradStudent.getStudentStatus(), STUDENT_STATUS_MERGED)) {
Expand Down Expand Up @@ -610,7 +610,7 @@ public void triggerGraduationBatchRun(EventType eventType, UUID studentID, Strin
}
}

private void handleAdultStartRule(ConvGradStudent student, Student penStudent, GraduationStudentRecord gradStudent) {
private void handleAdultStartRule(Student penStudent, GraduationStudentRecord gradStudent) {
if ("1950".equalsIgnoreCase(gradStudent.getProgram())) {
Date dob = EducGradDataConversionApiUtils.parseDate(penStudent.getDob());
Date adultStartDate = DateUtils.addYears(dob, 18);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import java.util.Arrays;
import java.util.List;

public class StudentBaseService {
public abstract class StudentBaseService {

// NULL String => Nullify (set to NULL)
public static final String NULL_VALUE = "NULL";

// Student Status
public static final String STUDENT_STATUS_CURRENT = "CUR";
Expand Down Expand Up @@ -109,14 +112,21 @@ protected String getGradProgram(String graduationRequirementYear, String schoolO
}

protected void populateNewBatchFlags(StudentGradDTO currentStudent) {
if (STUDENT_STATUS_ARCHIVED.equalsIgnoreCase(currentStudent.getStudentStatus())) {
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
} else {
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
// TVR
currentStudent.setNewRecalculateProjectedGrad("Y");
switch(currentStudent.getStudentStatus()) {
case STUDENT_STATUS_CURRENT -> {
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
// TVR
currentStudent.setNewRecalculateProjectedGrad("Y");
}
case STUDENT_STATUS_ARCHIVED, STUDENT_STATUS_TERMINATED ->
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
default -> {
// do not set flags to Y
currentStudent.setNewRecalculateGradStatus(null);
currentStudent.setNewRecalculateProjectedGrad(null);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
package ca.bc.gov.educ.api.dataconversion.service.student;

import ca.bc.gov.educ.api.dataconversion.model.StudentGradDTO;
import ca.bc.gov.educ.api.dataconversion.util.EducGradDataConversionApiUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;

import java.util.Date;

public abstract class StudentGraduationUpdateBaseService extends StudentBaseService {

protected abstract boolean hasAnyFrenchImmersionCourse(String gradProgramCode, String pen, String accessToken);

protected void handleProgramChange(String newGradProgram, StudentGradDTO currentStudent, String pen, String accessToken) {
boolean addDualDogwood = false;
boolean addFrenchImmersion = false;

if (!currentStudent.isSCCP() && currentStudent.isGraduated()) {
currentStudent.setNewProgram(null);
return;
}

if (newGradProgram.endsWith("-PF")) {
// from EN to PF
// from PF to PF
// from 1950 to PF
// from SCCP to PF
addDualDogwood = true;
} else if (newGradProgram.endsWith("-EN") && (currentStudent.getProgram().endsWith("-PF") || hasAnyFrenchImmersionCourse(newGradProgram, pen, accessToken))) {
// from PF to EN - allowed for SD93/Yukon PF schools
// from EN to EN
// from 1950 to EN
// from SCCP to EN
addFrenchImmersion = true;
}

currentStudent.setAddDualDogwood(addDualDogwood);
currentStudent.setAddFrenchImmersion(addFrenchImmersion);

currentStudent.setNewProgram(newGradProgram);
}

protected void handleAdultStartDate(StudentGradDTO currentStudent) {
if (StringUtils.equalsIgnoreCase(currentStudent.getNewProgram(), "1950") && StringUtils.isBlank(currentStudent.getAdultStartDate())) {
Date dob = EducGradDataConversionApiUtils.parseDate(currentStudent.getBirthday());
Date adultStartDate = DateUtils.addYears(dob, 18);
currentStudent.setNewAdultStartDate(EducGradDataConversionApiUtils.formatDate(adultStartDate)); // yyyy-MM-dd
}
}

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

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

protected boolean processGraduationProgram(StudentGradDTO currentStudent, String pen, String gradProgram, String accessToken) {
boolean isChanged = false;
switch(currentStudent.getStudentStatus()) {
case STUDENT_STATUS_CURRENT -> {
if (!currentStudent.isGraduated() || currentStudent.isSCCP()) {
// UpdData
handleProgramChange(gradProgram, currentStudent, pen, accessToken);
handleAdultStartDate(currentStudent);
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
// TVR
currentStudent.setNewRecalculateProjectedGrad("Y");
isChanged = true;
}
}
case STUDENT_STATUS_ARCHIVED, STUDENT_STATUS_TERMINATED -> {
if (!currentStudent.isGraduated() || currentStudent.isSCCP()) {
// UpdData
handleProgramChange(gradProgram, currentStudent, pen, accessToken);
handleAdultStartDate(currentStudent);
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
isChanged = true;
}
}
default -> { // MER or DEC
if (!currentStudent.isGraduated() || currentStudent.isSCCP()) {
// UpdData
handleProgramChange(gradProgram, currentStudent, pen, accessToken);
handleAdultStartDate(currentStudent);
// Do not set flags to Y
isChanged = true;
}
}

}
return isChanged;
}

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

}
return isChanged;
}

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

}
return isChanged;
}

protected void processStudentStatus(StudentGradDTO currentStudent, String value) {
// UpdData
currentStudent.setNewStudentStatus(value);
switch(value) {
case STUDENT_STATUS_ARCHIVED, STUDENT_STATUS_MERGED -> {
// TVR
currentStudent.setNewRecalculateProjectedGrad(NULL_VALUE);
}
case STUDENT_STATUS_CURRENT -> {
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
// TVR
currentStudent.setNewRecalculateProjectedGrad("Y");
}
case STUDENT_STATUS_TERMINATED -> {
// Transcript
currentStudent.setNewRecalculateGradStatus("Y");
// TVR
currentStudent.setNewRecalculateProjectedGrad(NULL_VALUE);
}
default -> { // DEC
}
}
}
}
Loading

0 comments on commit 44f4e67

Please sign in to comment.