Skip to content

Commit

Permalink
Grad release 1.10.0
Browse files Browse the repository at this point in the history
Grad release 1.10.0
  • Loading branch information
kamal-mohammed authored Nov 16, 2023
2 parents d930fb5 + c22bcf3 commit c7a850e
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 5 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-graduation-api</artifactId>
<version>1.8.46</version>
<version>1.8.49</version>
<name>educ-grad-graduation-api</name>
<description>Ministry of Education GRAD GRADUATION API</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

Expand Down Expand Up @@ -94,7 +95,9 @@ public String getCertificates() {
}

public void setCertificates(String certificates) {
this.certificates = certificates;
String nextSeparator = StringUtils.isNotBlank(this.certificates) ? "," : "";
String nextCertificate = StringUtils.isNotBlank(certificates) ? nextSeparator + certificates : "";
this.certificates = StringUtils.defaultIfBlank(this.certificates, "") + nextCertificate;
}

public String getGraduationMessage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,25 @@ public void setFineArtsAppliedSkills(String fineArtsAppliedSkills) {
this.fineArtsAppliedSkills = fineArtsAppliedSkills;
}

public boolean isDuplicate(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TranscriptCourse that = (TranscriptCourse) o;
return Objects.equals(getCode(), that.getCode()) && Objects.equals(getLevel(), that.getLevel());
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TranscriptCourse that = (TranscriptCourse) o;
return Objects.equals(code, that.code);
return Objects.equals(getCode(), that.getCode()) && Objects.equals(getLevel(), that.getLevel()) && Objects.equals(getSessionDate(), that.getSessionDate());

}

@Override
public int hashCode() {
return Objects.hash(code);
return Objects.hash(getCode(), getLevel(), getSessionDate());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public void setUsedForGrad(String value) {
this.usedForGrad = value;
}

public Double getCompletedPercentage() {
return this.mark != null? this.mark.getCompletedCoursePercentage() : null;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.*;
import java.util.stream.Collectors;

import static java.util.stream.Collectors.*;

@Slf4j
@Service
public class ReportService {
Expand Down Expand Up @@ -334,7 +336,7 @@ private void createCourseListForTranscript(List<StudentCourse> studentCourseList
}
result.setUsedForGrad(sc.getCreditsUsedForGrad() != null ? sc.getCreditsUsedForGrad().toString() : "");
result.setEquivalency(sc.getSpecialCase() != null && sc.getSpecialCase().compareTo("C") == 0 ? "C" : equivOrChallenge);
tList.add(result);
addIntoTranscriptList(result, tList);
}
}
}
Expand All @@ -357,6 +359,25 @@ private boolean isValidCutOffCourse(List<StudentCourse> studentCourseList, Stude
return false;
}

private void addIntoTranscriptList(TranscriptResult transcriptResult, List<TranscriptResult> tList) {
List<TranscriptResult> dups = tList.stream().filter(tr -> tr.getCourse().isDuplicate(transcriptResult.getCourse()) &&
!tr.getCourse().equals(transcriptResult.getCourse())
).sorted(Comparator.comparing(TranscriptResult::getCompletedPercentage, Comparator.nullsLast(Double::compareTo)).reversed()).toList();

// Handling duplicates
if (!dups.isEmpty()) {
TranscriptResult tr = dups.get(0);
// GRAD2-2394: only if a course taken previously was not used for grad(= requirementMet is blank), then the highest course will be taken
if (StringUtils.isBlank(tr.getRequirement()) && tr.getCompletedPercentage() < transcriptResult.getCompletedPercentage()) {
// replace
tList.remove(tr);
tList.add(transcriptResult);
return;
}
}
tList.add(transcriptResult);
}

private TranscriptCourse setCourseObjForTranscript(StudentCourse sc, ca.bc.gov.educ.api.graduation.model.dto.GraduationData graduationDataStatus) {
TranscriptCourse crse = new TranscriptCourse();
crse.setCode(sc.getCourseCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ private Student populateStudentObjectByReportGradStudentData(ReportGradStudentDa
gradStatus.setProgramCompletionDate(reportGradStudentData.getProgramCompletionDate());
gradStatus.setSchoolAtGrad(reportGradStudentData.getMincode());
gradStatus.setProgramName(reportGradStudentData.getProgramCode());
gradStatus.setCertificates(reportGradStudentData.getCertificateTypeCode());
student.setGraduationStatus(gradStatus);

ca.bc.gov.educ.api.graduation.model.report.GraduationData gradData = new ca.bc.gov.educ.api.graduation.model.report.GraduationData();
Expand Down
41 changes: 41 additions & 0 deletions api/src/test/resources/json/gradstatus.json
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,47 @@
"careerPrep": false,
"restricted": false
},
{
"pen": "111111111",
"courseCode": "PH",
"courseName": "PHYSICS 12",
"courseLevel": "11",
"sessionDate": "2020/06",
"customizedCourseName": "",
"gradReqMet": "",
"gradReqMetDetail": "",
"completedCoursePercentage": 57.0,
"completedCourseLetterGrade": "C",
"interimPercent": 0.0,
"interimLetterGrade": "",
"bestSchoolPercent": null,
"bestExamPercent": null,
"equivOrChallenge": "",
"fineArtsAppliedSkills": "",
"metLitNumRequirement": null,
"credits": 4,
"creditsUsedForGrad": 0,
"relatedCourse": "",
"relatedCourseName": null,
"relatedLevel": "",
"hasRelatedCourse": "N",
"genericCourseType": "",
"language": "",
"workExpFlag": null,
"provExamCourse": "N",
"notEligibleForElective": false,
"locallyDeveloped": false,
"independentDirectedStudies": false,
"boardAuthorityAuthorized": false,
"failed": false,
"duplicate": false,
"projected": false,
"notCompleted": false,
"used": false,
"careerPrep": false,
"restricted": false,
"cutOffCourse": false
},
{
"pen": "111111111",
"courseCode": "PH",
Expand Down

0 comments on commit c7a850e

Please sign in to comment.