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