Skip to content

Commit

Permalink
Grad release 1.14.0
Browse files Browse the repository at this point in the history
Grad release 1.14.0
  • Loading branch information
kamal-mohammed authored Feb 6, 2024
2 parents 5be9f47 + 1fda67f commit bb842a9
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 108 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.51</version>
<version>1.8.52</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 @@ -58,4 +58,6 @@ public class GradCourse {
// career life connections
private String careerLifeConnections;

// indigenous-focused
private String indigenousFocused;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ public boolean isGraduated() {
public boolean isSCCP() {
return "SCCP".equalsIgnoreCase(program);
}

public boolean isArchived() {
return "ARC".equalsIgnoreCase(studentStatus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class CourseProcess {
private static final String CPCOW_STR = "CPCOW";
private static final String CPSSA_STR = "CPSSA";

private static final List<String> RECENT_GRAD_PROGRAMS = Arrays.asList("2023", "2018");

private static final String ERR_MSG_FORMAT = "For {} : {}";

private static final List<CourseRequirementDTO> REMOVAL_LIST = new ArrayList<>();
Expand Down Expand Up @@ -187,6 +189,7 @@ public GradCourse convertCourseRequirement(GradCourse courseRequirement, Convers
processConsEd(courseRequirement, summary);
processFineArts(courseRequirement, summary);
processCareerLifeConnections(courseRequirement, summary);
handleExtras(courseRequirement, summary);
return courseRequirement;
}

Expand All @@ -205,10 +208,9 @@ private void processEnglish(GradCourse gradCourse, ConversionCourseSummaryDTO su

private void processEnglish10(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (StringUtils.isNotBlank(gradCourse.getEnglish10()) && StringUtils.equals(gradCourse.getEnglish10(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(),
"101"), summary);
gradCourse.getCourseLevel(), "101"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "701"), summary);
Expand All @@ -221,7 +223,7 @@ private void processEnglish10(GradCourse gradCourse, ConversionCourseSummaryDTO
private void handleFrenchLanguageCourseForEnglish10(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (hasFrenchLanguageCourse(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), summary.getAccessToken())) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "302"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -234,7 +236,7 @@ private void handleFrenchLanguageCourseForEnglish10(GradCourse gradCourse, Conve
private void handleBlankLanguageCourseForEnglish10(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (hasBlankLanguageCourse(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), summary.getAccessToken())) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "400"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -246,7 +248,7 @@ private void handleBlankLanguageCourseForEnglish10(GradCourse gradCourse, Conver

private void processEnglish11(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (StringUtils.isNotBlank(gradCourse.getEnglish11()) && StringUtils.equals(gradCourse.getEnglish11(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "102"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -266,7 +268,7 @@ private void processEnglish11(GradCourse gradCourse, ConversionCourseSummaryDTO

private void handleFrenchLanguageCourseForEnglish11(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (hasFrenchLanguageCourse(gradCourse.getCourseCode(), gradCourse.getCourseLevel(), summary.getAccessToken())) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "301"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -282,7 +284,7 @@ private void handleFrenchLanguageCourseForEnglish11(GradCourse gradCourse, Conve

private void handleBlankLanguageCourseForEnglish11(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (hasBlankLanguageCourse(gradCourse.getCourseCode(), gradCourse.getCourseLevel(), summary.getAccessToken())) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "401"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -294,7 +296,7 @@ private void handleBlankLanguageCourseForEnglish11(GradCourse gradCourse, Conver

private void processEnglish12(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (StringUtils.isNotBlank(gradCourse.getEnglish12()) && StringUtils.equals(gradCourse.getEnglish12(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "103"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -317,7 +319,7 @@ private void processEnglish12(GradCourse gradCourse, ConversionCourseSummaryDTO

private void handleFrenchLanguageCourseForEnglish12(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (hasFrenchLanguageCourse(gradCourse.getCourseCode(), gradCourse.getCourseLevel(), summary.getAccessToken())) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "300"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -332,7 +334,7 @@ private void handleFrenchLanguageCourseForEnglish12(GradCourse gradCourse, Conve

private void handleBlankLanguageCourseForEnglish12(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
if (hasBlankLanguageCourse(gradCourse.getCourseCode(), gradCourse.getCourseLevel(), summary.getAccessToken())) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "402"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -345,7 +347,7 @@ private void handleBlankLanguageCourseForEnglish12(GradCourse gradCourse, Conver
private void processSocials(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// socials10
if (StringUtils.isNotBlank(gradCourse.getSocials10()) && StringUtils.equals(gradCourse.getSocials10(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "104"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -355,7 +357,7 @@ private void processSocials(GradCourse gradCourse, ConversionCourseSummaryDTO su
}
// socials
if (StringUtils.isNotBlank(gradCourse.getSocials()) && StringUtils.equals(gradCourse.getSocials(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "105"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -377,7 +379,7 @@ private void processSocials(GradCourse gradCourse, ConversionCourseSummaryDTO su
private void processMath(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// math10
if (StringUtils.isNotBlank(gradCourse.getMath10()) && StringUtils.equals(gradCourse.getMath10(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "106"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -387,7 +389,7 @@ private void processMath(GradCourse gradCourse, ConversionCourseSummaryDTO summa
}
// math
if (StringUtils.isNotBlank(gradCourse.getMath()) && StringUtils.equals(gradCourse.getMath(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "107"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -409,7 +411,7 @@ private void processMath(GradCourse gradCourse, ConversionCourseSummaryDTO summa
private void processScience(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// science10
if (StringUtils.isNotBlank(gradCourse.getScience10()) && StringUtils.equals(gradCourse.getScience10(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "108"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -419,7 +421,7 @@ private void processScience(GradCourse gradCourse, ConversionCourseSummaryDTO su
}
// science
if (StringUtils.isNotBlank(gradCourse.getScience()) && StringUtils.equals(gradCourse.getScience(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "109"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -438,7 +440,7 @@ private void processScience(GradCourse gradCourse, ConversionCourseSummaryDTO su
private void processCareerPersonal(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// careerPersonal10
if (isCareerPersonal10(gradCourse)) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "112"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand Down Expand Up @@ -473,7 +475,7 @@ private boolean isCareerPersonal12(GradCourse gradCourse) {
private void processPhysEd(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// physEd10
if (StringUtils.isNotBlank(gradCourse.getPhysEd10()) && StringUtils.equals(gradCourse.getPhysEd10(), "Y")) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "110"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand All @@ -486,7 +488,7 @@ private void processPhysEd(GradCourse gradCourse, ConversionCourseSummaryDTO sum
private void processAppliedSkills(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// appliedSkills
if (isAppliedSkills(gradCourse)) {
if (StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "111"), summary);
} else if (StringUtils.equals(gradCourse.getGradReqtYear(), "2004")) {
Expand Down Expand Up @@ -541,7 +543,7 @@ private boolean isAppliedSkills(GradCourse gradCourse) {

private void processCareerLifeConnections(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// careerLifeConnections
if (isCareerLifeConnections(gradCourse) && StringUtils.equals(gradCourse.getGradReqtYear(), "2018")) {
if (isCareerLifeConnections(gradCourse) && isRecentGradProgram(gradCourse.getGradReqtYear())) {
createCourseRequirement(populate(gradCourse.getCourseCode(),
gradCourse.getCourseLevel(), "113"), summary);
}
Expand Down Expand Up @@ -1205,7 +1207,7 @@ private CourseRequirement createCourseRequirement(CourseRequirement courseRequir
ConversionAlert error = new ConversionAlert();
error.setLevel(ConversionAlert.AlertLevelEnum.ERROR);
error.setItem(courseRequirement.getCourseCode() + "/" + courseRequirement.getCourseLevel() + ", rule[" + courseRequirement.getRuleCode().getCourseRequirementCode() + "]");
error.setReason("GRAD Course API is failed to check Course Requirement exits!");
error.setReason("GRAD Course API is failed to check Course Requirement exists!");
summary.getErrors().add(error);
logger.error(ERR_MSG_FORMAT, error.getItem(), error.getReason());
return null;
Expand Down Expand Up @@ -1273,4 +1275,16 @@ public List<StudentCourse> getStudentCourses(String pen, String accessToken) {
return this.restUtils.getStudentCoursesByPen(pen, accessToken);
}

private void handleExtras(GradCourse gradCourse, ConversionCourseSummaryDTO summary) {
// Indigenous Focused for 2023 GRAD Program
if ("2023".equalsIgnoreCase(gradCourse.getGradReqtYear())
&& StringUtils.isNotBlank(gradCourse.getIndigenousFocused()) && StringUtils.equals(gradCourse.getIndigenousFocused(), "Y")) {
createCourseRequirement(populate(gradCourse.getCourseCode(), gradCourse.getCourseLevel(), "119"), summary);
}
}

private boolean isRecentGradProgram(String gradReqtYear) {
return RECENT_GRAD_PROGRAMS.contains(gradReqtYear);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ public ReportData prepareTranscriptData(GraduationData graduationDataStatus, Gra
data.setGraduationData(getGraduationData(graduationDataStatus));
data.setLogo(StringUtils.startsWith(data.getSchool().getMincode(), "098") ? "YU" : "BC");
data.setTranscript(getTranscriptData(graduationDataStatus, gradResponse, convStudent, accessToken));
data.setNonGradReasons(getNonGradReasons(graduationDataStatus.getNonGradReasons()));
data.setNonGradReasons(getNonGradReasons(graduationDataStatus.getGradStatus().getProgram(), graduationDataStatus.getNonGradReasons()));
return data;
}

private List<NonGradReason> getNonGradReasons(List<GradRequirement> nonGradReasons) {
private List<NonGradReason> getNonGradReasons(String gradProgramCode, List<GradRequirement> nonGradReasons) {
List<NonGradReason> nList = new ArrayList<>();
if (nonGradReasons != null) {
if(nonGradReasons != null && !nonGradReasons.isEmpty()) {
nonGradReasons.removeIf(a -> "506".equalsIgnoreCase(a.getRule()) && (StringUtils.isNotBlank(gradProgramCode) && gradProgramCode.contains("1950")));
for (GradRequirement gR : nonGradReasons) {
NonGradReason obj = new NonGradReason();
obj.setCode(gR.getRule());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ public <T extends Object> void processEvent(T request, Event event) {

public void processAssessment(TraxStudentUpdateDTO studentAssessmentUpdate, StudentGradDTO currentStudent, String accessToken) {
log.info(" Process Assessment : studentID = {}, pen = {} ", currentStudent.getStudentID(),studentAssessmentUpdate.getPen());
studentProcess.triggerGraduationBatchRun(ASSESSMENT, currentStudent.getStudentID(), studentAssessmentUpdate.getPen(), "Y", "Y", accessToken);

// Transcript & TVR
populateNewBatchFlags(currentStudent);

studentProcess.triggerGraduationBatchRun(ASSESSMENT, currentStudent.getStudentID(), studentAssessmentUpdate.getPen(), currentStudent.getNewRecalculateGradStatus(), currentStudent.getNewRecalculateProjectedGrad(), accessToken);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ca.bc.gov.educ.api.dataconversion.model.ConvGradStudent;
import ca.bc.gov.educ.api.dataconversion.model.ConversionAlert;
import ca.bc.gov.educ.api.dataconversion.model.ConversionStudentSummaryDTO;
import ca.bc.gov.educ.api.dataconversion.model.StudentGradDTO;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
Expand Down Expand Up @@ -126,6 +127,18 @@ protected String getGradProgramForGraduatedStudent(String graduationRequirementY
return gradProgram;
}

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");
}
}

private void updateProgramCountsInSummary(ConversionStudentSummaryDTO summary, String programCode, boolean isGraduated) {
if (summary != null) {
summary.increment(programCode, isGraduated);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ public <T extends Object> void processEvent(T request, Event event) {

public void processCourse(TraxStudentUpdateDTO studentCourseUpdate, StudentGradDTO currentStudent, String accessToken) {
log.info(" Process Course : studentID = {}, pen = {} ", currentStudent.getStudentID(), studentCourseUpdate.getPen());
studentProcess.triggerGraduationBatchRun(COURSE, currentStudent.getStudentID(), studentCourseUpdate.getPen(), "Y", "Y", accessToken);

// Transcript & TVR
populateNewBatchFlags(currentStudent);

studentProcess.triggerGraduationBatchRun(COURSE, currentStudent.getStudentID(), studentCourseUpdate.getPen(), currentStudent.getNewRecalculateGradStatus(), currentStudent.getNewRecalculateProjectedGrad(), accessToken);
}

@Override
Expand Down
Loading

0 comments on commit bb842a9

Please sign in to comment.