From e7f74ab8328713d0e721f887b58ed581e82d12b5 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Mon, 27 Nov 2023 14:57:15 -0800 Subject: [PATCH 01/12] GRAD2-2023: task is complete. GRAD2-2023: task is complete. --- .../educ/api/ruleengine/dto/StudentCourse.java | 5 +++++ .../ruleengine/rule/MatchCredit1996Rule.java | 10 ++++++++-- .../api/ruleengine/rule/MinCredit1996Rule.java | 18 +++++++++++++++--- .../rule/MinElectiveCredits1996Rule.java | 9 +++++++-- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java index ac99ca8..9b1cc00 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java @@ -1,5 +1,6 @@ package ca.bc.gov.educ.api.ruleengine.dto; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -59,10 +60,14 @@ public class StudentCourse implements Serializable { private boolean isRestricted; private boolean isNotEligibleForElective; private boolean isUsedInMatchRule; + private boolean isLessCreditCourse; private boolean isValidationCourse; private boolean isCutOffCourse; private boolean isGrade10Course; + @JsonIgnore + private boolean isUsedInMinCreditRule; + @JsonIgnore private Integer leftOverCredits; public Integer getCreditsUsedForGrad() { diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index 3f6dd3b..36559e7 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -119,6 +119,7 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) && tempCourse.getCredits() > Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits())) { int extraCredits = tempCourse.getCredits() - Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits()); map1996.put(tempCourse.getCourseCode(), extraCredits); + tempCourse.setLeftOverCredits(extraCredits); } } } @@ -166,6 +167,7 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) if (tempProgramRule != null && tempCourse.getCredits() > Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits())) { int extraCredits = tempCourse.getCredits() - Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits()); map1996.put(tempCourse.getCourseCode(), extraCredits); + tempCourse.setLeftOverCredits(extraCredits); } } } @@ -253,6 +255,7 @@ private void processCourse(StudentCourse tempCourse, List tem if(tempCourse.getCredits() > Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits())) { int extraCredits = tempCourse.getCredits() - Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits()); map1996.put(tempCourse.getCourseCode(),extraCredits); + tempCourse.setLeftOverCredits(extraCredits); } setDetailsForCourses(tempCourse, tempProgramRule, requirementsMet); } @@ -339,12 +342,15 @@ public void processReqMetAndNotMet(List finalProgramRulesLis } public void setDetailsForCourses(StudentCourse tempCourse, ProgramRequirement tempProgramRule, List requirementsMet) { - tempCourse.setUsed(true); + tempCourse.setUsed(true); tempCourse.setUsedInMatchRule(true); - tempCourse.setCreditsUsedForGrad(tempCourse.getCredits()); + tempCourse.setCreditsUsedForGrad(tempCourse.getLeftOverCredits() != null && tempCourse.getLeftOverCredits() != 0? tempCourse.getLeftOverCredits():tempCourse.getCredits()); AlgorithmSupportRule.setGradReqMet(tempCourse,tempProgramRule); tempProgramRule.getProgramRequirementCode().setPassed(true); requirementsMet.add(new GradRequirement(tempProgramRule.getProgramRequirementCode().getTraxReqNumber(), tempProgramRule.getProgramRequirementCode().getLabel(),tempProgramRule.getProgramRequirementCode().getProReqCode())); + logger.debug("==> MatchCredit [{}/{}] met Course [{}/{}] => Credits [{}], CreditsUsedForGrad [{}], OriginalCredits [{}], LeftOverCredits [{}]", + tempProgramRule.getGraduationProgramCode(), tempProgramRule.getProgramRequirementCode().getProReqCode(), tempCourse.getCourseCode(), tempCourse.getCourseLevel(), + tempCourse.getCredits(), tempCourse.getCreditsUsedForGrad(), tempCourse.getOriginalCredits(), tempCourse.getLeftOverCredits()); } private boolean isFineArtsOrAppliedSkillsRule(String programRequirementCode) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java index d07624f..15727bb 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -31,8 +32,9 @@ public RuleData fire() { List tempStudentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - List studentCourses = tempStudentCourseList.stream().filter(sc -> !sc.isUsedInMatchRule()).collect(Collectors.toList()); - + List studentCourses = tempStudentCourseList.stream().filter(sc -> !sc.isUsedInMatchRule() || (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)).collect(Collectors.toList()); + studentCourses.sort(Comparator.comparing(StudentCourse::getCourseLevel, Comparator.reverseOrder()) + .thenComparing(StudentCourse::getCompletedCoursePercentage, Comparator.reverseOrder())); List gradProgramRules = ruleProcessorData.getGradProgramRules() .stream() .filter(gpr -> "MC".compareTo(gpr.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 @@ -55,6 +57,12 @@ public RuleData fire() { .filter(sc -> sc.getCourseLevel().contains(requiredLevel) && !sc.getCourseCode().startsWith("X")) .mapToInt(StudentCourse::getCredits) .sum(); + studentCourses + .stream() + .filter(sc -> sc.getCourseLevel().contains(requiredLevel) && !sc.getCourseCode().startsWith("X")) + .forEach(sc -> logger.debug("Total Credits: Course [{}/{}] => Credits [{}], CreditsUsedForGrad [{}], OriginalCredits [{}], leftOverCredits [{}]", + sc.getCourseCode(), sc.getCourseLevel(), + sc.getCredits(), sc.getCreditsUsedForGrad(), sc.getOriginalCredits(), sc.getLeftOverCredits())); } setCoursesReqMet(studentCourses,gradProgramRule,requiredCredits); @@ -96,7 +104,7 @@ public RuleData fire() { logger.debug("Min Credits -> Required: {} Has : {}",requiredCredits,totalCredits); } - studentCourses.addAll(tempStudentCourseList.stream().filter(StudentCourse::isUsedInMatchRule).collect(Collectors.toList())); + studentCourses.addAll(tempStudentCourseList.stream().filter(sc -> sc.isUsedInMatchRule() && sc.getLeftOverCredits() == null).collect(Collectors.toList())); ruleProcessorData.setStudentCourses(studentCourses); return ruleProcessorData; } @@ -118,6 +126,10 @@ private void setCoursesReqMet(List studentCourses, ProgramRequire public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule) { sc.setUsed(true); + sc.setUsedInMinCreditRule(true); + logger.debug("==> MinCredit met Course [{}/{}] => Credits [{}], CreditsUsedForGrad [{}], OriginalCredits [{}], leftOverCredits [{}]", + sc.getCourseCode(), sc.getCourseLevel(), + sc.getCredits(), sc.getCreditsUsedForGrad(), sc.getOriginalCredits(), sc.getLeftOverCredits()); AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index d7cc6b8..407ae33 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -35,11 +35,16 @@ public RuleData fire() { Map map1996 = ruleProcessorData.getMap1996Crse(); int ldCourseCounter = 0; - List studentCourses = RuleProcessorRuleUtils + List tempStudentCourseList = RuleProcessorRuleUtils .getUniqueStudentCourses(ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - studentCourses.sort(Comparator.comparing(StudentCourse::getCourseLevel).reversed() + List minCreditGrade12Courses = tempStudentCourseList.stream().filter(StudentCourse::isUsedInMinCreditRule).collect(Collectors.toList()); + tempStudentCourseList.removeAll(minCreditGrade12Courses); + tempStudentCourseList.sort(Comparator.comparing(StudentCourse::getCourseLevel).reversed() .thenComparing(StudentCourse::getCompletedCoursePercentage).reversed()); + List studentCourses = new ArrayList<>(minCreditGrade12Courses); + studentCourses.addAll(tempStudentCourseList); + List gradProgramRules = ruleProcessorData .getGradProgramRules().stream().filter(gpr -> "MCE".compareTo(gpr.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 && "Y".compareTo(gpr.getProgramRequirementCode().getActiveRequirement()) == 0 && "C".compareTo(gpr.getProgramRequirementCode().getRequirementCategory()) == 0) From ff8b8401937729d4a13e3c6d8c4f95d979b6a7da Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Tue, 28 Nov 2023 09:31:20 -0800 Subject: [PATCH 02/12] Removed the code smell & clean up debugging codes. Removed the code smell & clean up debugging codes. --- .../educ/api/ruleengine/rule/MatchCredit1996Rule.java | 7 ++----- .../gov/educ/api/ruleengine/rule/MinCredit1996Rule.java | 9 --------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index 36559e7..ff2110d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -52,7 +52,7 @@ public RuleData fire() { List courseList = RuleProcessorRuleUtils .getUniqueStudentCourses(ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()) .stream().filter(studentCourse -> studentCourse.getFineArtsAppliedSkills() == null - || studentCourse.getFineArtsAppliedSkills().length() <= 0) + || studentCourse.getFineArtsAppliedSkills().length() == 0) .collect(Collectors.toList()); courseList.sort(Comparator.comparing(StudentCourse::getCourseLevel) .thenComparing(StudentCourse::getCompletedCoursePercentage, Comparator.reverseOrder())); @@ -344,13 +344,10 @@ public void processReqMetAndNotMet(List finalProgramRulesLis public void setDetailsForCourses(StudentCourse tempCourse, ProgramRequirement tempProgramRule, List requirementsMet) { tempCourse.setUsed(true); tempCourse.setUsedInMatchRule(true); - tempCourse.setCreditsUsedForGrad(tempCourse.getLeftOverCredits() != null && tempCourse.getLeftOverCredits() != 0? tempCourse.getLeftOverCredits():tempCourse.getCredits()); + tempCourse.setCreditsUsedForGrad(tempCourse.getLeftOverCredits() != null && tempCourse.getLeftOverCredits() > 0? tempCourse.getLeftOverCredits():tempCourse.getCredits()); AlgorithmSupportRule.setGradReqMet(tempCourse,tempProgramRule); tempProgramRule.getProgramRequirementCode().setPassed(true); requirementsMet.add(new GradRequirement(tempProgramRule.getProgramRequirementCode().getTraxReqNumber(), tempProgramRule.getProgramRequirementCode().getLabel(),tempProgramRule.getProgramRequirementCode().getProReqCode())); - logger.debug("==> MatchCredit [{}/{}] met Course [{}/{}] => Credits [{}], CreditsUsedForGrad [{}], OriginalCredits [{}], LeftOverCredits [{}]", - tempProgramRule.getGraduationProgramCode(), tempProgramRule.getProgramRequirementCode().getProReqCode(), tempCourse.getCourseCode(), tempCourse.getCourseLevel(), - tempCourse.getCredits(), tempCourse.getCreditsUsedForGrad(), tempCourse.getOriginalCredits(), tempCourse.getLeftOverCredits()); } private boolean isFineArtsOrAppliedSkillsRule(String programRequirementCode) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java index 15727bb..1424574 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java @@ -57,12 +57,6 @@ public RuleData fire() { .filter(sc -> sc.getCourseLevel().contains(requiredLevel) && !sc.getCourseCode().startsWith("X")) .mapToInt(StudentCourse::getCredits) .sum(); - studentCourses - .stream() - .filter(sc -> sc.getCourseLevel().contains(requiredLevel) && !sc.getCourseCode().startsWith("X")) - .forEach(sc -> logger.debug("Total Credits: Course [{}/{}] => Credits [{}], CreditsUsedForGrad [{}], OriginalCredits [{}], leftOverCredits [{}]", - sc.getCourseCode(), sc.getCourseLevel(), - sc.getCredits(), sc.getCreditsUsedForGrad(), sc.getOriginalCredits(), sc.getLeftOverCredits())); } setCoursesReqMet(studentCourses,gradProgramRule,requiredCredits); @@ -127,9 +121,6 @@ private void setCoursesReqMet(List studentCourses, ProgramRequire public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule) { sc.setUsed(true); sc.setUsedInMinCreditRule(true); - logger.debug("==> MinCredit met Course [{}/{}] => Credits [{}], CreditsUsedForGrad [{}], OriginalCredits [{}], leftOverCredits [{}]", - sc.getCourseCode(), sc.getCourseLevel(), - sc.getCredits(), sc.getCreditsUsedForGrad(), sc.getOriginalCredits(), sc.getLeftOverCredits()); AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); } From b517e28f260808eefd466cb0e628f0d8c1f329c0 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Wed, 29 Nov 2023 17:26:25 -0800 Subject: [PATCH 03/12] GRAD2-2023: course with leftover credits is fixed to get the right credits used for grad. GRAD2-2023: course with leftover credits is fixed to get the right credits used for grad. --- .../bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java | 2 +- .../api/ruleengine/rule/MinElectiveCredits1996Rule.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java index 1424574..6765563 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java @@ -40,7 +40,7 @@ public RuleData fire() { .filter(gpr -> "MC".compareTo(gpr.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 && "Y".compareTo(gpr.getProgramRequirementCode().getActiveRequirement()) == 0 && "C".compareTo(gpr.getProgramRequirementCode().getRequirementCategory()) == 0) - .collect(Collectors.toList()); + .distinct().toList(); if (tempStudentCourseList.isEmpty()) { logger.warn("!!!Empty list sent to Min Credits Rule for processing"); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index 407ae33..fb11609 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -48,7 +48,7 @@ public RuleData fire() { List gradProgramRules = ruleProcessorData .getGradProgramRules().stream().filter(gpr -> "MCE".compareTo(gpr.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 && "Y".compareTo(gpr.getProgramRequirementCode().getActiveRequirement()) == 0 && "C".compareTo(gpr.getProgramRequirementCode().getRequirementCategory()) == 0) - .collect(Collectors.toList()); + .distinct().toList(); if (studentCourses.isEmpty()) { logger.warn("!!!Empty list sent to Min Elective Credits Rule for processing"); @@ -71,11 +71,11 @@ public RuleData fire() { } if (totalCredits + map1996.get(sc.getCourseCode()) <= requiredCredits) { totalCredits += map1996.get(sc.getCourseCode()); - sc.setCreditsUsedForGrad(map1996.get(sc.getCourseCode())); + sc.setCreditsUsedForGrad(sc.getCreditsUsedForGrad() + map1996.get(sc.getCourseCode())); } else { int extraCredits = totalCredits + map1996.get(sc.getCourseCode()) - requiredCredits; totalCredits = requiredCredits; - sc.setCreditsUsedForGrad(map1996.get(sc.getCourseCode()) - extraCredits); + sc.setCreditsUsedForGrad(sc.getCreditsUsedForGrad() + map1996.get(sc.getCourseCode()) - extraCredits); } AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); sc.setUsed(true); From d5e41a27bd10c89c74012839814c06a429126c98 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Mon, 4 Dec 2023 15:03:51 -0800 Subject: [PATCH 04/12] GRAD2-2023: elective credits calculation is fixed to use up to the"min grade 12 credits" GRAD2-2023: elective credits calculation is fixed to use up to the"min grade 12 credits" --- .../educ/api/ruleengine/rule/AlgorithmSupportRule.java | 5 +++-- .../gov/educ/api/ruleengine/rule/MinCredit1996Rule.java | 8 +++++--- api/src/test/resources/1996-EN-101821056.json | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java index b0d3cfa..a9ef212 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java @@ -146,8 +146,9 @@ public static int processExtraCredits(boolean extraCreditsUsed, int extraCredits } } else { if (totalCredits + sc.getCredits() <= requiredCredits) { - totalCredits += sc.getCredits(); - sc.setCreditsUsedForGrad(sc.getCredits()); + int credits = sc.isUsedInMinCreditRule() && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)? sc.getCredits() - sc.getLeftOverCredits() : sc.getCredits(); + totalCredits += credits; + sc.setCreditsUsedForGrad(credits); } else { int extraCredits = totalCredits + sc.getCredits() - requiredCredits; totalCredits = requiredCredits; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java index 6765563..dd9edf4 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java @@ -109,18 +109,20 @@ private void setCoursesReqMet(List studentCourses, ProgramRequire for(StudentCourse sc:studentCourses) { if(sc.getCourseLevel().contains(gradProgramRule.getProgramRequirementCode().getRequiredLevel().trim()) && !sc.getCourseCode().startsWith("X")) { tC += sc.getCredits(); - processReqMet(sc,gradProgramRule); + processReqMet(sc,gradProgramRule, tC, requiredCredits); if (tC > requiredCredits) { break; } - } } } - public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule) { + public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule, int totalCredits, int requiredCredits) { sc.setUsed(true); sc.setUsedInMinCreditRule(true); + if (totalCredits > requiredCredits) { + sc.setLeftOverCredits(totalCredits - requiredCredits); + } AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); } diff --git a/api/src/test/resources/1996-EN-101821056.json b/api/src/test/resources/1996-EN-101821056.json index ecdf056..4945b81 100644 --- a/api/src/test/resources/1996-EN-101821056.json +++ b/api/src/test/resources/1996-EN-101821056.json @@ -1229,7 +1229,7 @@ "pen": "101821056", "courseCode": "CAPP", "courseName": "CAREER & PERSONAL PLANNING 12", - "originalCredits": 2, + "originalCredits": 4, "courseLevel": "12", "sessionDate": "1999/06", "customizedCourseName": "", @@ -1244,7 +1244,7 @@ "equivOrChallenge": "", "fineArtsAppliedSkills": "", "metLitNumRequirement": null, - "credits": 2, + "credits": 4, "creditsUsedForGrad": 0, "relatedCourse": "", "relatedCourseName": null, From 2a450ee1a72b29cad0f0da9c5da0d45c178939c1 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Mon, 4 Dec 2023 15:29:54 -0800 Subject: [PATCH 05/12] GRAD2-2417: task is complete. GRAD2-2417: task is complete. --- .../java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java index aea5720..2ef5d47 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java @@ -273,6 +273,7 @@ private void handleFailedRules(OptionalProgramRuleProcessor obj, List Date: Tue, 5 Dec 2023 09:47:26 -0800 Subject: [PATCH 06/12] GRAD2-2023: fixed the sorting order in minElectiveCredits1996Rule. GRAD2-2023: fixed the sorting order in minElectiveCredits1996Rule. --- .../educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index fb11609..64aeeea 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -39,8 +39,7 @@ public RuleData fire() { .getUniqueStudentCourses(ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); List minCreditGrade12Courses = tempStudentCourseList.stream().filter(StudentCourse::isUsedInMinCreditRule).collect(Collectors.toList()); tempStudentCourseList.removeAll(minCreditGrade12Courses); - tempStudentCourseList.sort(Comparator.comparing(StudentCourse::getCourseLevel).reversed() - .thenComparing(StudentCourse::getCompletedCoursePercentage).reversed()); + tempStudentCourseList.sort(Comparator.comparing(StudentCourse::getCompletedCoursePercentage).reversed()); List studentCourses = new ArrayList<>(minCreditGrade12Courses); studentCourses.addAll(tempStudentCourseList); From bfb368a01f07fa176d425b6ae79db82f8a5bc81a Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Wed, 6 Dec 2023 14:21:04 -0800 Subject: [PATCH 07/12] GRAD2-2023: refactored not to use map1996 and fixed the credits calculation for grad on minGrade12Credit courses with leftover credits that are used twice in elective rule. GRAD2-2023: refactored not to use map1996 and fixed the credits calculation for grad on minGrade12Credit courses with leftover credits that are used twice in elective rule. --- .../api/ruleengine/dto/RuleProcessorData.java | 1 - .../ruleengine/rule/AlgorithmSupportRule.java | 5 +- .../ruleengine/rule/MatchCredit1996Rule.java | 19 +-- .../ruleengine/rule/MinCredit1996Rule.java | 4 +- .../rule/MinElectiveCredits1996Rule.java | 120 ++++++++++-------- api/src/test/resources/1950-122740988.json | 1 - api/src/test/resources/1950-EN-2.json | 2 +- api/src/test/resources/1950-EN-3.json | 2 +- api/src/test/resources/1950-EN-4.json | 2 +- api/src/test/resources/1950-EN.json | 2 +- api/src/test/resources/1986-EN-105581557.json | 2 +- api/src/test/resources/1996-EN-101039378.json | 2 +- api/src/test/resources/1996-EN-101171718.json | 2 +- api/src/test/resources/1996-EN-101541068.json | 2 +- api/src/test/resources/1996-EN-101821056.json | 2 +- api/src/test/resources/1996-EN-104337712.json | 2 +- api/src/test/resources/1996-EN-106945306.json | 2 +- api/src/test/resources/1996-EN-109491597.json | 2 +- api/src/test/resources/1996-PF-104573159.json | 2 +- api/src/test/resources/2004-EN-117346452.json | 2 +- api/src/test/resources/2018-EN-109496042.json | 2 +- api/src/test/resources/2018-EN-123236440.json | 2 +- api/src/test/resources/2018-EN-126187616.json | 2 +- api/src/test/resources/2018-EN-127970861.json | 2 +- api/src/test/resources/2018-EN-DUP-ASSMT.json | 2 +- .../resources/2018-EN-MIN-CREDIT-FAIL.json | 2 +- api/src/test/resources/2018-EN-UNGRAD.json | 2 +- api/src/test/resources/2018-EN.json | 2 +- api/src/test/resources/2018-PF.json | 2 +- api/src/test/resources/2023-EN-109496042.json | 2 +- api/src/test/resources/DD-FAIL.json | 2 +- api/src/test/resources/FI-126259126.json | 2 +- api/src/test/resources/FI.json | 2 +- .../test/resources/SCCP-130319387-fail.json | 2 +- api/src/test/resources/SCCP-130319387.json | 2 +- 35 files changed, 108 insertions(+), 100 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleProcessorData.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleProcessorData.java index 3854be9..54b664c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleProcessorData.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleProcessorData.java @@ -23,7 +23,6 @@ public class RuleProcessorData implements RuleData { private List algorithmRules; private List gradProgramRules; private Map mapOptional; - private Map map1996Crse; private List studentCourses; private List excludedCourses; private List excludedAssessments; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java index a9ef212..b0d3cfa 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java @@ -146,9 +146,8 @@ public static int processExtraCredits(boolean extraCreditsUsed, int extraCredits } } else { if (totalCredits + sc.getCredits() <= requiredCredits) { - int credits = sc.isUsedInMinCreditRule() && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)? sc.getCredits() - sc.getLeftOverCredits() : sc.getCredits(); - totalCredits += credits; - sc.setCreditsUsedForGrad(credits); + totalCredits += sc.getCredits(); + sc.setCreditsUsedForGrad(sc.getCredits()); } else { int extraCredits = totalCredits + sc.getCredits() - requiredCredits; totalCredits = requiredCredits; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index ff2110d..405cf2b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -39,7 +39,6 @@ public RuleData fire() { List requirementsMet = new ArrayList<>(); List requirementsNotMet = new ArrayList<>(); - Map map1996 = new HashMap<>(); List fineArtsCourseList = RuleProcessorRuleUtils .getUniqueStudentCourses(ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()) @@ -118,14 +117,13 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) if (tempProgramRule != null && tempCourse.getCredits() > Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits())) { int extraCredits = tempCourse.getCredits() - Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits()); - map1996.put(tempCourse.getCourseCode(), extraCredits); tempCourse.setLeftOverCredits(extraCredits); } } } } logger.debug("Temp Program Rule: {}", tempProgramRule); - processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch, map1996); + processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch); AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); @@ -166,14 +164,13 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) if (tempProgramRule != null && tempCourse.getCredits() > Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits())) { int extraCredits = tempCourse.getCredits() - Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits()); - map1996.put(tempCourse.getCourseCode(), extraCredits); tempCourse.setLeftOverCredits(extraCredits); } } } } logger.debug("Temp Program Rule: {}", tempProgramRule); - processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch, map1996); + processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch); AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); @@ -181,12 +178,11 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) logger.debug("Final Program rules list: {}",finalProgramRulesList); processReqMetAndNotMet(finalProgramRulesList,requirementsNotMet,finalCourseList,originalCourseRequirements,requirementsMet,gradProgramRulesMatch); - ruleProcessorData.setMap1996Crse(map1996); - checkAppliedScienceAndFineArtsCondition(ruleProcessorData.getStudentCourses(),ruleProcessorData.getRequirementsMet(),ruleProcessorData.getNonGradReasons(),ruleProcessorData.getMap1996Crse()); + checkAppliedScienceAndFineArtsCondition(ruleProcessorData.getStudentCourses(),ruleProcessorData.getRequirementsMet(),ruleProcessorData.getNonGradReasons()); return ruleProcessorData; } - private void checkAppliedScienceAndFineArtsCondition(List studentCourses, List requirementsMet, List nonGradReasons, Map map1996Crse) { + private void checkAppliedScienceAndFineArtsCondition(List studentCourses, List requirementsMet, List nonGradReasons) { boolean reqmtSatisfied = false; int counter = 0; //counter to keep track of fine arts and applied science rule codes for(GradRequirement gR:requirementsMet) { @@ -215,15 +211,15 @@ private void checkAppliedScienceAndFineArtsCondition(List student sc.setUsed(false); sc.setUsedInMatchRule(false); - if(map1996Crse.get(sc.getCourseCode()) != null) { - map1996Crse.remove(sc.getCourseCode()); + if (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0) { + sc.setLeftOverCredits(null); } } } } } - private void processCourse(StudentCourse tempCourse, List tempCourseRequirements, ProgramRequirement tempProgramRule, List requirementsMet, List gradProgramRulesMatch, Map map1996) { + private void processCourse(StudentCourse tempCourse, List tempCourseRequirements, ProgramRequirement tempProgramRule, List requirementsMet, List gradProgramRulesMatch) { if (!tempCourseRequirements.isEmpty() && tempProgramRule != null) { ProgramRequirement finalTempProgramRule = tempProgramRule; if (requirementsMet.stream() @@ -254,7 +250,6 @@ private void processCourse(StudentCourse tempCourse, List tem if (tempProgramRule != null) { if(tempCourse.getCredits() > Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits())) { int extraCredits = tempCourse.getCredits() - Integer.parseInt(tempProgramRule.getProgramRequirementCode().getRequiredCredits()); - map1996.put(tempCourse.getCourseCode(),extraCredits); tempCourse.setLeftOverCredits(extraCredits); } setDetailsForCourses(tempCourse, tempProgramRule, requirementsMet); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java index dd9edf4..f9f8c43 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java @@ -121,7 +121,9 @@ public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule, sc.setUsed(true); sc.setUsedInMinCreditRule(true); if (totalCredits > requiredCredits) { - sc.setLeftOverCredits(totalCredits - requiredCredits); + int leftOverCredit = totalCredits - requiredCredits; + sc.setCreditsUsedForGrad(sc.getCredits() - leftOverCredit); + sc.setLeftOverCredits(leftOverCredit); } AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index 64aeeea..83feab9 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -5,6 +5,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.apache.commons.lang3.tuple.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -13,7 +14,6 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; @Data @@ -33,23 +33,22 @@ public RuleData fire() { List requirementsNotMet = new ArrayList<>(); - Map map1996 = ruleProcessorData.getMap1996Crse(); int ldCourseCounter = 0; List tempStudentCourseList = RuleProcessorRuleUtils .getUniqueStudentCourses(ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); List minCreditGrade12Courses = tempStudentCourseList.stream().filter(StudentCourse::isUsedInMinCreditRule).collect(Collectors.toList()); + List minCreditGrade12CoursesWithLeftOverCredits = minCreditGrade12Courses.stream() + .filter(sc -> sc.isUsedInMinCreditRule() && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)).collect(Collectors.toList()); tempStudentCourseList.removeAll(minCreditGrade12Courses); + tempStudentCourseList.addAll(minCreditGrade12CoursesWithLeftOverCredits); tempStudentCourseList.sort(Comparator.comparing(StudentCourse::getCompletedCoursePercentage).reversed()); - List studentCourses = new ArrayList<>(minCreditGrade12Courses); - studentCourses.addAll(tempStudentCourseList); - List gradProgramRules = ruleProcessorData .getGradProgramRules().stream().filter(gpr -> "MCE".compareTo(gpr.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 && "Y".compareTo(gpr.getProgramRequirementCode().getActiveRequirement()) == 0 && "C".compareTo(gpr.getProgramRequirementCode().getRequirementCategory()) == 0) .distinct().toList(); - if (studentCourses.isEmpty()) { + if (minCreditGrade12Courses.isEmpty() && tempStudentCourseList.isEmpty()) { logger.warn("!!!Empty list sent to Min Elective Credits Rule for processing"); AlgorithmSupportRule.processEmptyCourseCondition(ruleProcessorData,ruleProcessorData.getGradProgramRules(),requirementsNotMet); return ruleProcessorData; @@ -59,52 +58,15 @@ public RuleData fire() { if(gradProgramRule.getProgramRequirementCode().getRequiredLevel() == null) { requiredCredits = Integer.parseInt(gradProgramRule.getProgramRequirementCode().getRequiredCredits().trim()); // list - for (StudentCourse sc : studentCourses) { - if (map1996.get(sc.getCourseCode()) != null) { - if (sc.getCourseCode().startsWith("X")) { - if (ldCourseCounter < 8) { - ldCourseCounter += map1996.get(sc.getCourseCode()); - } else { - continue; - } - } - if (totalCredits + map1996.get(sc.getCourseCode()) <= requiredCredits) { - totalCredits += map1996.get(sc.getCourseCode()); - sc.setCreditsUsedForGrad(sc.getCreditsUsedForGrad() + map1996.get(sc.getCourseCode())); - } else { - int extraCredits = totalCredits + map1996.get(sc.getCourseCode()) - requiredCredits; - totalCredits = requiredCredits; - sc.setCreditsUsedForGrad(sc.getCreditsUsedForGrad() + map1996.get(sc.getCourseCode()) - extraCredits); - } - AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); - sc.setUsed(true); - } else { - if (!sc.isUsedInMatchRule()) { - boolean extraCreditsUsed = false; - int extraCreditsLDcrses = 0; - if (sc.getCourseCode().startsWith("X")) { - if (ldCourseCounter < 8) { - if (ldCourseCounter + sc.getCredits() <= 8) { - ldCourseCounter += sc.getCredits(); - } else { - int extraCredits = ldCourseCounter + sc.getCredits() - 8; - ldCourseCounter += extraCredits; - extraCreditsLDcrses = extraCredits; - extraCreditsUsed = true; - } - } else { - continue; - } - } - totalCredits = AlgorithmSupportRule.processExtraCredits(extraCreditsUsed,extraCreditsLDcrses,sc,totalCredits,requiredCredits); - AlgorithmSupportRule.setGradReqMet(sc,gradProgramRule); - sc.setUsed(true); - } - } - if (totalCredits == requiredCredits) { - break; - } - } + // 1st: minGrade12CreditCourses + Pair counts = handleStudentCourses(gradProgramRule, requiredCredits, minCreditGrade12Courses, totalCredits, ldCourseCounter, true); + totalCredits = counts.getLeft(); + ldCourseCounter = counts.getRight(); + + // 2nd: the rest of courses + (minGrade12CreditCourses with leftOverCredit > 0) + counts = handleStudentCourses(gradProgramRule, requiredCredits, tempStudentCourseList, totalCredits, ldCourseCounter, false); + totalCredits = counts.getLeft(); + AlgorithmSupportRule.checkCredits1996(totalCredits,requiredCredits,gradProgramRule,ruleProcessorData); totalCredits = 0; } @@ -115,7 +77,59 @@ public RuleData fire() { return ruleProcessorData; } - + private Pair handleStudentCourses(ProgramRequirement gradProgramRule, Integer requiredCredits, List studentCourses, + Integer totalCredits, Integer ldCourseCounter, boolean onlyMinGrade12CreditCourses) { + for (StudentCourse sc : studentCourses) { + if ((sc.isUsedInMatchRule() || sc.isUsedInMinCreditRule()) + && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)) { + if (sc.getCourseCode().startsWith("X")) { + if (ldCourseCounter < 8) { + ldCourseCounter += sc.getLeftOverCredits(); + } else { + continue; + } + } + if (totalCredits + sc.getLeftOverCredits() <= requiredCredits) { + totalCredits += sc.getLeftOverCredits(); + int credits = onlyMinGrade12CreditCourses? sc.getLeftOverCredits() : sc.getCreditsUsedForGrad() + sc.getLeftOverCredits(); + sc.setCreditsUsedForGrad(credits > sc.getCredits() ? sc.getCredits() : credits); + } else { + int extraCredits = totalCredits + sc.getLeftOverCredits() - requiredCredits; + totalCredits = requiredCredits; + int credits = sc.getCreditsUsedForGrad() + sc.getLeftOverCredits() - extraCredits; + sc.setCreditsUsedForGrad(credits > sc.getCredits() ? sc.getCredits() : credits); + } + AlgorithmSupportRule.setGradReqMet(sc, gradProgramRule); + sc.setUsed(true); + } else { + if (!sc.isUsedInMatchRule()) { + boolean extraCreditsUsed = false; + int extraCreditsLDcrses = 0; + if (sc.getCourseCode().startsWith("X")) { + if (ldCourseCounter < 8) { + if (ldCourseCounter + sc.getCredits() <= 8) { + ldCourseCounter += sc.getCredits(); + } else { + int extraCredits = ldCourseCounter + sc.getCredits() - 8; + ldCourseCounter += extraCredits; + extraCreditsLDcrses = extraCredits; + extraCreditsUsed = true; + } + } else { + continue; + } + } + totalCredits = AlgorithmSupportRule.processExtraCredits(extraCreditsUsed, extraCreditsLDcrses, sc, totalCredits, requiredCredits); + AlgorithmSupportRule.setGradReqMet(sc, gradProgramRule); + sc.setUsed(true); + } + } + if (totalCredits == requiredCredits) { + break; + } + } + return Pair.of(totalCredits, ldCourseCounter); + } @Override public void setInputData(RuleData inputData) { diff --git a/api/src/test/resources/1950-122740988.json b/api/src/test/resources/1950-122740988.json index 07fca81..401f53f 100644 --- a/api/src/test/resources/1950-122740988.json +++ b/api/src/test/resources/1950-122740988.json @@ -619,7 +619,6 @@ } ], "mapOptional": {}, - "map1996Crse": null, "studentCourses": [ { "pen": "122740988", diff --git a/api/src/test/resources/1950-EN-2.json b/api/src/test/resources/1950-EN-2.json index 036b37e..bbb30dd 100644 --- a/api/src/test/resources/1950-EN-2.json +++ b/api/src/test/resources/1950-EN-2.json @@ -619,7 +619,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "120408505", diff --git a/api/src/test/resources/1950-EN-3.json b/api/src/test/resources/1950-EN-3.json index 036b37e..bbb30dd 100644 --- a/api/src/test/resources/1950-EN-3.json +++ b/api/src/test/resources/1950-EN-3.json @@ -619,7 +619,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "120408505", diff --git a/api/src/test/resources/1950-EN-4.json b/api/src/test/resources/1950-EN-4.json index 036b37e..bbb30dd 100644 --- a/api/src/test/resources/1950-EN-4.json +++ b/api/src/test/resources/1950-EN-4.json @@ -619,7 +619,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "120408505", diff --git a/api/src/test/resources/1950-EN.json b/api/src/test/resources/1950-EN.json index 69e933c..08670f3 100644 --- a/api/src/test/resources/1950-EN.json +++ b/api/src/test/resources/1950-EN.json @@ -619,7 +619,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "124428368", diff --git a/api/src/test/resources/1986-EN-105581557.json b/api/src/test/resources/1986-EN-105581557.json index fef8c08..e322a08 100644 --- a/api/src/test/resources/1986-EN-105581557.json +++ b/api/src/test/resources/1986-EN-105581557.json @@ -554,7 +554,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "105581557", diff --git a/api/src/test/resources/1996-EN-101039378.json b/api/src/test/resources/1996-EN-101039378.json index 0a189fe..a661edf 100644 --- a/api/src/test/resources/1996-EN-101039378.json +++ b/api/src/test/resources/1996-EN-101039378.json @@ -765,7 +765,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "101039378", diff --git a/api/src/test/resources/1996-EN-101171718.json b/api/src/test/resources/1996-EN-101171718.json index dd7c677..82fcc09 100644 --- a/api/src/test/resources/1996-EN-101171718.json +++ b/api/src/test/resources/1996-EN-101171718.json @@ -684,7 +684,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "101171718", diff --git a/api/src/test/resources/1996-EN-101541068.json b/api/src/test/resources/1996-EN-101541068.json index 7df5ba4..7bd2a22 100644 --- a/api/src/test/resources/1996-EN-101541068.json +++ b/api/src/test/resources/1996-EN-101541068.json @@ -684,7 +684,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "101541068", diff --git a/api/src/test/resources/1996-EN-101821056.json b/api/src/test/resources/1996-EN-101821056.json index 4945b81..b11c168 100644 --- a/api/src/test/resources/1996-EN-101821056.json +++ b/api/src/test/resources/1996-EN-101821056.json @@ -684,7 +684,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "101821056", diff --git a/api/src/test/resources/1996-EN-104337712.json b/api/src/test/resources/1996-EN-104337712.json index 86b6393..1f8d4ab 100644 --- a/api/src/test/resources/1996-EN-104337712.json +++ b/api/src/test/resources/1996-EN-104337712.json @@ -684,7 +684,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "104337712", diff --git a/api/src/test/resources/1996-EN-106945306.json b/api/src/test/resources/1996-EN-106945306.json index 959861f..bd7cbe9 100644 --- a/api/src/test/resources/1996-EN-106945306.json +++ b/api/src/test/resources/1996-EN-106945306.json @@ -684,7 +684,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "106945306", diff --git a/api/src/test/resources/1996-EN-109491597.json b/api/src/test/resources/1996-EN-109491597.json index 4dafb6d..7f15a5c 100644 --- a/api/src/test/resources/1996-EN-109491597.json +++ b/api/src/test/resources/1996-EN-109491597.json @@ -833,7 +833,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "109491597", diff --git a/api/src/test/resources/1996-PF-104573159.json b/api/src/test/resources/1996-PF-104573159.json index 1519c23..180ce1a 100644 --- a/api/src/test/resources/1996-PF-104573159.json +++ b/api/src/test/resources/1996-PF-104573159.json @@ -778,7 +778,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "104573159", diff --git a/api/src/test/resources/2004-EN-117346452.json b/api/src/test/resources/2004-EN-117346452.json index 4dc91c6..edac520 100644 --- a/api/src/test/resources/2004-EN-117346452.json +++ b/api/src/test/resources/2004-EN-117346452.json @@ -814,7 +814,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "117346452", diff --git a/api/src/test/resources/2018-EN-109496042.json b/api/src/test/resources/2018-EN-109496042.json index 8de1bd3..2889136 100644 --- a/api/src/test/resources/2018-EN-109496042.json +++ b/api/src/test/resources/2018-EN-109496042.json @@ -957,7 +957,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "109496042", diff --git a/api/src/test/resources/2018-EN-123236440.json b/api/src/test/resources/2018-EN-123236440.json index c06f508..576d1ca 100644 --- a/api/src/test/resources/2018-EN-123236440.json +++ b/api/src/test/resources/2018-EN-123236440.json @@ -957,7 +957,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "123236440", diff --git a/api/src/test/resources/2018-EN-126187616.json b/api/src/test/resources/2018-EN-126187616.json index 4b8d38d..c4c0052 100644 --- a/api/src/test/resources/2018-EN-126187616.json +++ b/api/src/test/resources/2018-EN-126187616.json @@ -970,7 +970,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "126187616", diff --git a/api/src/test/resources/2018-EN-127970861.json b/api/src/test/resources/2018-EN-127970861.json index 86f3d4c..6a476b0 100644 --- a/api/src/test/resources/2018-EN-127970861.json +++ b/api/src/test/resources/2018-EN-127970861.json @@ -1208,7 +1208,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "127970861", diff --git a/api/src/test/resources/2018-EN-DUP-ASSMT.json b/api/src/test/resources/2018-EN-DUP-ASSMT.json index 954ebec..107ee8c 100644 --- a/api/src/test/resources/2018-EN-DUP-ASSMT.json +++ b/api/src/test/resources/2018-EN-DUP-ASSMT.json @@ -918,7 +918,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "126889930", diff --git a/api/src/test/resources/2018-EN-MIN-CREDIT-FAIL.json b/api/src/test/resources/2018-EN-MIN-CREDIT-FAIL.json index a8a79f4..ce001a8 100644 --- a/api/src/test/resources/2018-EN-MIN-CREDIT-FAIL.json +++ b/api/src/test/resources/2018-EN-MIN-CREDIT-FAIL.json @@ -918,7 +918,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "128310000", diff --git a/api/src/test/resources/2018-EN-UNGRAD.json b/api/src/test/resources/2018-EN-UNGRAD.json index b0d1d23..0b94771 100644 --- a/api/src/test/resources/2018-EN-UNGRAD.json +++ b/api/src/test/resources/2018-EN-UNGRAD.json @@ -918,7 +918,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "136557584", diff --git a/api/src/test/resources/2018-EN.json b/api/src/test/resources/2018-EN.json index e0a5b35..cd63588 100644 --- a/api/src/test/resources/2018-EN.json +++ b/api/src/test/resources/2018-EN.json @@ -1169,7 +1169,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "126966100", diff --git a/api/src/test/resources/2018-PF.json b/api/src/test/resources/2018-PF.json index d22800a..95fff0f 100644 --- a/api/src/test/resources/2018-PF.json +++ b/api/src/test/resources/2018-PF.json @@ -1169,7 +1169,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "126885227", diff --git a/api/src/test/resources/2023-EN-109496042.json b/api/src/test/resources/2023-EN-109496042.json index 8de1bd3..2889136 100644 --- a/api/src/test/resources/2023-EN-109496042.json +++ b/api/src/test/resources/2023-EN-109496042.json @@ -957,7 +957,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "109496042", diff --git a/api/src/test/resources/DD-FAIL.json b/api/src/test/resources/DD-FAIL.json index 9d00b5e..505af97 100644 --- a/api/src/test/resources/DD-FAIL.json +++ b/api/src/test/resources/DD-FAIL.json @@ -1109,7 +1109,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "132641986", diff --git a/api/src/test/resources/FI-126259126.json b/api/src/test/resources/FI-126259126.json index e545de2..0e464d8 100644 --- a/api/src/test/resources/FI-126259126.json +++ b/api/src/test/resources/FI-126259126.json @@ -1208,7 +1208,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "126259126", diff --git a/api/src/test/resources/FI.json b/api/src/test/resources/FI.json index a9bfc88..ec1a5d9 100644 --- a/api/src/test/resources/FI.json +++ b/api/src/test/resources/FI.json @@ -1169,7 +1169,7 @@ "optionalProgramGraduated": true } }, - "map1996Crse": null, + "studentCourses": [ { "pen": "126885227", diff --git a/api/src/test/resources/SCCP-130319387-fail.json b/api/src/test/resources/SCCP-130319387-fail.json index 7f5767b..441b53b 100644 --- a/api/src/test/resources/SCCP-130319387-fail.json +++ b/api/src/test/resources/SCCP-130319387-fail.json @@ -333,7 +333,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "130319387", diff --git a/api/src/test/resources/SCCP-130319387.json b/api/src/test/resources/SCCP-130319387.json index 47ae6b2..08d92ac 100644 --- a/api/src/test/resources/SCCP-130319387.json +++ b/api/src/test/resources/SCCP-130319387.json @@ -333,7 +333,7 @@ } ], "mapOptional": {}, - "map1996Crse": null, + "studentCourses": [ { "pen": "130319387", From 0382d1a1159188913c847aa50c697f33bd44d573 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Wed, 6 Dec 2023 15:50:46 -0800 Subject: [PATCH 08/12] Trying to remove the code smells. Trying to remove the code smells. --- .../ruleengine/rule/MinElectiveCredits1996Rule.java | 5 +++-- .../api/ruleengine/service/RuleEngineServiceTest.java | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index 83feab9..8a0af28 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; @Data @@ -38,7 +39,7 @@ public RuleData fire() { .getUniqueStudentCourses(ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); List minCreditGrade12Courses = tempStudentCourseList.stream().filter(StudentCourse::isUsedInMinCreditRule).collect(Collectors.toList()); List minCreditGrade12CoursesWithLeftOverCredits = minCreditGrade12Courses.stream() - .filter(sc -> sc.isUsedInMinCreditRule() && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)).collect(Collectors.toList()); + .filter(sc -> sc.isUsedInMinCreditRule() && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)).toList(); tempStudentCourseList.removeAll(minCreditGrade12Courses); tempStudentCourseList.addAll(minCreditGrade12CoursesWithLeftOverCredits); tempStudentCourseList.sort(Comparator.comparing(StudentCourse::getCompletedCoursePercentage).reversed()); @@ -124,7 +125,7 @@ private Pair handleStudentCourses(ProgramRequirement gradProgr sc.setUsed(true); } } - if (totalCredits == requiredCredits) { + if (Objects.equals(totalCredits, requiredCredits)) { break; } } diff --git a/api/src/test/java/ca/bc/gov/educ/api/ruleengine/service/RuleEngineServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/ruleengine/service/RuleEngineServiceTest.java index 8942a92..6a33d74 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/ruleengine/service/RuleEngineServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/ruleengine/service/RuleEngineServiceTest.java @@ -144,6 +144,16 @@ public void testProcessGradAlgorithmRules_1950EN_2_projectedfalse() { ruleProcessorData = ruleEngineService.processGradAlgorithmRules(ruleProcessorData); assertNotNull(ruleProcessorData); } + + @Test + public void testProcessGradAlgorithmRules_1996EN_emptyCourses() { + RuleProcessorData ruleProcessorData = getRuleProcessorData("1996-EN-101039378"); + assert ruleProcessorData != null; + ruleProcessorData.setStudentCourses(new ArrayList<>()); + ruleProcessorData.setProjected(false); + ruleProcessorData = ruleEngineService.processGradAlgorithmRules(ruleProcessorData); + assertNotNull(ruleProcessorData); + } @Test public void testProcessGradAlgorithmRules_1950EN_3_projectedfalse() { From d3451312e767294fd484957ff7646681cd75e4fa Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Wed, 6 Dec 2023 16:26:23 -0800 Subject: [PATCH 09/12] Trying to resolve duplicate code failure from sonar code quality. Trying to resolve duplicate code failure from sonar code quality. --- .../api/ruleengine/rule/MatchCredit1986Rule.java | 7 +------ .../api/ruleengine/rule/MatchCredit1996Rule.java | 7 +------ .../rule/MinElectiveCredits1996Rule.java | 8 ++++---- .../api/ruleengine/util/RuleEngineApiUtils.java | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java index 5154a8d..e356547 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java @@ -37,12 +37,7 @@ public RuleData fire() { courseList.sort(Comparator.comparing(StudentCourse::getCourseLevel).reversed() .thenComparing(StudentCourse::getCompletedCoursePercentage).reversed()); - List gradProgramRulesMatch = ruleProcessorData.getGradProgramRules() - .stream() - .filter(gradProgramRule -> "M".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 - && "Y".compareTo(gradProgramRule.getProgramRequirementCode().getActiveRequirement()) == 0 - && "C".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementCategory()) == 0) - .collect(Collectors.toList()); + List gradProgramRulesMatch = RuleEngineApiUtils.getMatchProgramRules(ruleProcessorData.getGradProgramRules()); if (courseList.isEmpty()) { logger.warn("!!!Empty list sent to Match Credit 1986 Rule for processing"); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index 405cf2b..843f9ce 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -56,12 +56,7 @@ public RuleData fire() { courseList.sort(Comparator.comparing(StudentCourse::getCourseLevel) .thenComparing(StudentCourse::getCompletedCoursePercentage, Comparator.reverseOrder())); - List gradProgramRulesMatch = ruleProcessorData.getGradProgramRules() - .stream() - .filter(gradProgramRule -> "M".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 - && "Y".compareTo(gradProgramRule.getProgramRequirementCode().getActiveRequirement()) == 0 - && "C".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementCategory()) == 0) - .collect(Collectors.toList()); + List gradProgramRulesMatch = RuleEngineApiUtils.getMatchProgramRules(ruleProcessorData.getGradProgramRules()); if (courseList.isEmpty()) { logger.warn("!!!Empty list sent to Match Credit 1996 Rule for processing"); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index 8a0af28..fdfe761 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -60,12 +60,12 @@ public RuleData fire() { requiredCredits = Integer.parseInt(gradProgramRule.getProgramRequirementCode().getRequiredCredits().trim()); // list // 1st: minGrade12CreditCourses - Pair counts = handleStudentCourses(gradProgramRule, requiredCredits, minCreditGrade12Courses, totalCredits, ldCourseCounter, true); + Pair counts = processCourse(gradProgramRule, requiredCredits, minCreditGrade12Courses, totalCredits, ldCourseCounter, true); totalCredits = counts.getLeft(); ldCourseCounter = counts.getRight(); // 2nd: the rest of courses + (minGrade12CreditCourses with leftOverCredit > 0) - counts = handleStudentCourses(gradProgramRule, requiredCredits, tempStudentCourseList, totalCredits, ldCourseCounter, false); + counts = processCourse(gradProgramRule, requiredCredits, tempStudentCourseList, totalCredits, ldCourseCounter, false); totalCredits = counts.getLeft(); AlgorithmSupportRule.checkCredits1996(totalCredits,requiredCredits,gradProgramRule,ruleProcessorData); @@ -78,8 +78,8 @@ public RuleData fire() { return ruleProcessorData; } - private Pair handleStudentCourses(ProgramRequirement gradProgramRule, Integer requiredCredits, List studentCourses, - Integer totalCredits, Integer ldCourseCounter, boolean onlyMinGrade12CreditCourses) { + private Pair processCourse(ProgramRequirement gradProgramRule, Integer requiredCredits, List studentCourses, + Integer totalCredits, Integer ldCourseCounter, boolean onlyMinGrade12CreditCourses) { for (StudentCourse sc : studentCourses) { if ((sc.isUsedInMatchRule() || sc.isUsedInMinCreditRule()) && (sc.getLeftOverCredits() != null && sc.getLeftOverCredits() > 0)) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java index 47fa067..f84598c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java @@ -14,9 +14,11 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.Period; +import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; public class RuleEngineApiUtils { @@ -112,6 +114,18 @@ public static List getCloneProgramRule(List getMatchProgramRules(List gradProgramRules) { + if (gradProgramRules.isEmpty()) { + return new ArrayList<>(); + } + return gradProgramRules.stream() + .filter(gradProgramRule -> "M".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) == 0 + && "Y".compareTo(gradProgramRule.getProgramRequirementCode().getActiveRequirement()) == 0 + && "C".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementCategory()) == 0) + .collect(Collectors.toList()); + } + public static List getCloneOptionalProgramRule(List rules) { ObjectMapper mapper = new ObjectMapper(); try { From 7986b25342eb3a00c816a5a69d60246b50ca9294 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Wed, 6 Dec 2023 16:37:55 -0800 Subject: [PATCH 10/12] Round 2 to resolve duplicate codes by sonar code quality. Round 2 to resolve duplicate codes by sonar code quality. --- .../educ/api/ruleengine/rule/MatchCredit1996Rule.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index 843f9ce..5e69854 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -56,24 +56,19 @@ public RuleData fire() { courseList.sort(Comparator.comparing(StudentCourse::getCourseLevel) .thenComparing(StudentCourse::getCompletedCoursePercentage, Comparator.reverseOrder())); - List gradProgramRulesMatch = RuleEngineApiUtils.getMatchProgramRules(ruleProcessorData.getGradProgramRules()); - if (courseList.isEmpty()) { logger.warn("!!!Empty list sent to Match Credit 1996 Rule for processing"); return ruleProcessorData; } - List courseRequirements = ruleProcessorData.getCourseRequirements(); - if(courseRequirements == null) { - courseRequirements = new ArrayList<>(); - } + List courseRequirements = ruleProcessorData.getCourseRequirements() == null? new ArrayList<>() : ruleProcessorData.getCourseRequirements(); List originalCourseRequirements = new ArrayList<>(courseRequirements); + List gradProgramRulesMatch = RuleEngineApiUtils.getMatchProgramRules(ruleProcessorData.getGradProgramRules()); logger.debug("#### Match Program Rule size: {}",gradProgramRulesMatch.size()); List finalCourseList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - for (StudentCourse tempCourse : fineArtsCourseList) { logger.debug("Processing Course: Code= {} Level = {}", tempCourse.getCourseCode(), tempCourse.getCourseLevel()); From c09ad62de528e94816697b6b28dc81522ef6ff57 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Wed, 6 Dec 2023 17:06:20 -0800 Subject: [PATCH 11/12] Round 3: trying to resolve duplicate codes complained by sonar code quality. Round 3: trying to resolve duplicate codes complained by sonar code quality. --- .../gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index 5e69854..abf7b68 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -71,7 +71,7 @@ public RuleData fire() { List finalProgramRulesList = new ArrayList<>(); for (StudentCourse tempCourse : fineArtsCourseList) { - logger.debug("Processing Course: Code= {} Level = {}", tempCourse.getCourseCode(), tempCourse.getCourseLevel()); + logger.debug("Processing FineArts Course: Code= {} Level = {}", tempCourse.getCourseCode(), tempCourse.getCourseLevel()); logger.debug("Course Requirements size: {}", courseRequirements.size()); List tempCourseRequirements = courseRequirements.stream() @@ -112,13 +112,13 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) } } } - logger.debug("Temp Program Rule: {}", tempProgramRule); + logger.debug("Temp Program Rule for FineArts Course: {}", tempProgramRule); processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch); AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); } - logger.debug("Final Program rules list: {}",finalProgramRulesList); + logger.debug("Final Program rules list for FineArts Course: {}",finalProgramRulesList); processReqMet(finalProgramRulesList,finalCourseList,originalCourseRequirements,requirementsMet,gradProgramRulesMatch); for (StudentCourse tempCourse : courseList) { From d2fd2f557e279b10097341845eddffb4a76f451d Mon Sep 17 00:00:00 2001 From: Kamal Mohammed Date: Thu, 7 Dec 2023 13:38:17 -0700 Subject: [PATCH 12/12] Update pom.xml --- api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/pom.xml b/api/pom.xml index da96dbf..5d09f52 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -10,7 +10,7 @@ ca.bc.gov.educ educ-grad-rule-engine-api - 1.8.52 + 1.8.53 educ-grad-rule-engine-api Rule Engine API for GRAD team