Skip to content

Commit

Permalink
Sync 1.9.1 from main
Browse files Browse the repository at this point in the history
Sync 1.9.1 from main
  • Loading branch information
kamal-mohammed authored Nov 7, 2023
2 parents 4bf576d + d930fb5 commit 4f6ddc8
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public WebClient webClient() {
return WebClient.builder().exchangeStrategies(ExchangeStrategies.builder()
.codecs(configurer -> configurer
.defaultCodecs()
.maxInMemorySize(40 * 1024 * 1024)) // 40MB
.maxInMemorySize(100 * 1024 * 1024)) // 100MB
.build())
.filter(this.log())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,16 @@ private Transcript getTranscriptData(ca.bc.gov.educ.api.graduation.model.dto.Gra
private void createCourseListForTranscript(List<StudentCourse> studentCourseList, ca.bc.gov.educ.api.graduation.model.dto.GraduationData graduationDataStatus, List<TranscriptResult> tList, String provincially, boolean xml) {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"), Locale.CANADA);
String today = EducGraduationApiUtils.formatDate(cal.getTime(), EducGraduationApiConstants.DEFAULT_DATE_FORMAT);

for (StudentCourse sc : studentCourseList) {
Date sessionDate = EducGraduationApiUtils.parseDate(sc.getSessionDate() + "/01", EducGraduationApiConstants.SECONDARY_DATE_FORMAT);
String sDate = EducGraduationApiUtils.formatDate(sessionDate, EducGraduationApiConstants.DEFAULT_DATE_FORMAT);
int diff = EducGraduationApiUtils.getDifferenceInMonths(sDate, today);
boolean notCompletedCourse = xml && diff <= 0;
if (!sc.isDuplicate() && !sc.isFailed() && !sc.isNotCompleted() && !sc.isCutOffCourse() && ((notCompletedCourse) || !sc.isProjected()) && !sc.isValidationCourse()) {
if (!sc.isDuplicate() && !sc.isFailed() && !sc.isNotCompleted() && ((notCompletedCourse) || !sc.isProjected()) && !sc.isValidationCourse()) {
if (sc.isCutOffCourse() && !isValidCutOffCourse(studentCourseList, sc)) {
continue;
}
TranscriptResult result = new TranscriptResult();
String equivOrChallenge = "";
if (sc.getEquivOrChallenge() != null) {
Expand All @@ -335,6 +339,24 @@ private void createCourseListForTranscript(List<StudentCourse> studentCourseList
}
}

/**
* check if the given cutoff course is the highest mark among the same courses, then it should be in transcript even though it is duplicate
* @param studentCourseList
* @param cutOffCourse
* @return
*/
private boolean isValidCutOffCourse(List<StudentCourse> studentCourseList, StudentCourse cutOffCourse) {
List<StudentCourse> dups = studentCourseList.stream().filter(sc ->
StringUtils.equalsIgnoreCase(sc.getCourseCode(), cutOffCourse.getCourseCode()) && StringUtils.equalsIgnoreCase(sc.getCourseLevel(), cutOffCourse.getCourseLevel())
).sorted(Comparator.comparing(StudentCourse::getCompletedCoursePercentage, Comparator.nullsLast(Double::compareTo)).reversed()).toList();

if (!dups.isEmpty()) {
StudentCourse topMarkCourse = dups.get(0);
return StringUtils.equalsIgnoreCase(topMarkCourse.getSessionDate(), cutOffCourse.getSessionDate());
}
return false;
}

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 Expand Up @@ -489,7 +511,7 @@ public List<StudentAssessment> removeDuplicatedAssessmentsForTranscript(List<Stu
.map((StudentAssessment studentAssessment) -> new StudentAssessmentDuplicatesWrapper(studentAssessment, xml))
.distinct()
.map(StudentAssessmentDuplicatesWrapper::getStudentAssessment)
.collect(Collectors.toList());
.toList();
}

private List<TranscriptResult> getTranscriptResults(ca.bc.gov.educ.api.graduation.model.dto.GraduationData graduationDataStatus, boolean xml, String accessToken) {
Expand Down Expand Up @@ -805,11 +827,11 @@ private void getStudentCoursesAssessmentsNExams(ReportData data, ca.bc.gov.educ.
List<StudentCourse> studentExamList = sCList
.stream()
.filter(sc -> "Y".compareTo(sc.getProvExamCourse()) == 0)
.collect(Collectors.toList());
.toList();
List<StudentCourse> studentCourseList = sCList
.stream()
.filter(sc -> "N".compareTo(sc.getProvExamCourse()) == 0)
.collect(Collectors.toList());
.toList();
List<StudentAssessment> studentAssessmentList = graduationDataStatus.getStudentAssessments().getStudentAssessmentList();
List<AchievementCourse> sCourseList = new ArrayList<>();
List<Exam> sExamList = new ArrayList<>();
Expand Down Expand Up @@ -1025,12 +1047,10 @@ public ReportData prepareCertificateData(GraduationStudentRecord gradResponse,
data.setUpdateDate(EducGraduationApiUtils.formatDateForReportJasper(gradResponse.getUpdateDate().toString()));
data.setCertificate(getCertificateData(gradResponse, certType));
data.getStudent().setGraduationData(graduationData);
switch (certType.getCertificateTypeCode()) {
case "F", "SCF", "S":
data.getStudent().setFrenchCert(certType.getCertificateTypeCode());
break;
default:
data.getStudent().setEnglishCert(certType.getCertificateTypeCode());
if (certType.getCertificateTypeCode().equals("F") || certType.getCertificateTypeCode().equals("SCF") || certType.getCertificateTypeCode().equals("S")) {
data.getStudent().setFrenchCert(certType.getCertificateTypeCode());
} else {
data.getStudent().setEnglishCert(certType.getCertificateTypeCode());
}
return data;
}
Expand Down Expand Up @@ -1182,7 +1202,7 @@ private List<GradRequirement> getRequirementsMetAchvReport(List<ca.bc.gov.educ.a
List<StudentCourse> scList = optionalStudentCourses.getStudentCourseList()
.stream()
.filter(sc -> gr.getTranscriptRule() != null && sc.getGradReqMet().contains(gr.getTranscriptRule()))
.collect(Collectors.toList());
.toList();
List<AchievementCourse> cdList = new ArrayList<>();
scList.forEach(sc -> {
AchievementCourse cD = new AchievementCourse();
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 @@ -1370,6 +1370,47 @@
"used": false,
"careerPrep": false,
"restricted": false
},
{
"pen": "111111111",
"courseCode": "PH",
"courseName": "PHYSICS 12",
"courseLevel": "11",
"sessionDate": "2023/06",
"customizedCourseName": "",
"gradReqMet": "",
"gradReqMetDetail": "",
"completedCoursePercentage": 67.0,
"completedCourseLetterGrade": "C+",
"interimPercent": 67.0,
"interimLetterGrade": "C+",
"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": true
}
]
},
Expand Down

0 comments on commit 4f6ddc8

Please sign in to comment.