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 ff9d399 + 4068061 commit 8334ecd
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>ca.bc.gov.educ</groupId>
<artifactId>educ-grad-report-api</artifactId>
<name>educ-grad-report-api</name>
<version>1.8.51</version>
<version>1.8.53</version>
<description>Ministry of Education and Child Care REPORT API</description>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ public interface CertificateTypeCodeRepository extends JpaRepository<Certificate

@Query("select t from CertificateTypeCodeEntity t join StudentCertificateEntity c on t.certificateTypeCode = c.certificateTypeCode where c.documentStatusCode='COMPL' and c.graduationStudentRecordId=:graduationStudentRecordId")
List<CertificateTypeCodeEntity> getStudentCertificateTypes(UUID graduationStudentRecordId);

@Query("select t from CertificateTypeCodeEntity t join StudentCertificateEntity c on t.certificateTypeCode = c.certificateTypeCode where c.documentStatusCode='COMPL' and c.graduationStudentRecordId=:graduationStudentRecordId and c.certificateTypeCode in (:certificateTypeCode)")
List<CertificateTypeCodeEntity> getStudentCertificateTypes(UUID graduationStudentRecordId, List<String> certificateTypeCode);
}
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,19 @@ public Pair<List<Student>, TotalCounts> getStudents(ReportData reportData) {
Optional<Date> distributionDate = studentCertificateRepository.getCertificateDistributionDate(UUID.fromString(pen.getEntityId()));
distributionDate.ifPresent(student::setCertificateDistributionDate);

List<CertificateTypeCodeEntity> certificateTypes = certificateTypeCodeRepository.getStudentCertificateTypes(UUID.fromString(pen.getEntityId()));
List<String> studentCertificateTypeCodes = new ArrayList<>();
if(st.getGraduationStatus() != null && StringUtils.isNotBlank(st.getGraduationStatus().getCertificates())) {
String studentCertificateTypeCodesString = st.getGraduationStatus().getCertificates();
log.debug("Process student {} certificate credentials {}", student.getPen(), studentCertificateTypeCodesString);
studentCertificateTypeCodes = Arrays.asList(StringUtils.split(studentCertificateTypeCodesString, ","));
}

List<CertificateTypeCodeEntity> certificateTypes;
if(!studentCertificateTypeCodes.isEmpty()) {
certificateTypes = certificateTypeCodeRepository.getStudentCertificateTypes(UUID.fromString(pen.getEntityId()), studentCertificateTypeCodes);
} else {
certificateTypes = certificateTypeCodeRepository.getStudentCertificateTypes(UUID.fromString(pen.getEntityId()));
}
student.setCertificateTypes(certificateTypes.stream().map(CertificateTypeCodeEntity::getLabel).collect(Collectors.toList()));
totals.countCertificate(certificateTypes.size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package ca.bc.gov.educ.grad.report.dto.impl;

import ca.bc.gov.educ.grad.report.model.transcript.TranscriptCourse;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;
import java.util.logging.Logger;
Expand Down Expand Up @@ -240,20 +241,17 @@ public boolean courseEquals(final TranscriptCourse compareCourse) {
@Override
public boolean compareCourse(final TranscriptCourse compareCourse) {

final int interimPercentage = getInt(this.getInterimMark());
final int finalPercentage = getInt(this.getFinalPercent());
final int compareFinalPercentage = getInt(compareCourse.getFinalPercent());
final int compareInterimPercentage = getInt(compareCourse.getInterimMark());
// Interim % should only be looked at if the courses do not have a final LG
final int percentage = StringUtils.isBlank(this.getFinalLetterGrade())? getInt(this.getInterimMark()) : getInt(this.getFinalPercent());
final int comparePercentage = StringUtils.isBlank(compareCourse.getFinalLetterGrade())? getInt(compareCourse.getInterimMark()) : getInt(compareCourse.getFinalPercent());

// Removes duplication of courses by comparing and finding course with
//highest percentage.
boolean replaceCourse = ((interimPercentage < compareFinalPercentage
&& finalPercentage < compareFinalPercentage
&& compareFinalPercentage != 0)
|| (finalPercentage < compareInterimPercentage
&& finalPercentage != 0
&& compareInterimPercentage != 0));
return replaceCourse;
// highest percentage.
return percentage <= comparePercentage && comparePercentage != 0;
}

public boolean isCompletedCourseUsedForGrad() {
return StringUtils.isNotBlank(this.finalLetterGrade) && StringUtils.isNotBlank(this.requirement);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,10 @@ public interface TranscriptCourse {
* @return true when compareCourse has highest marks.
*/
boolean compareCourse(final TranscriptCourse compareCourse);

/**
* Check this course is completed and used for graduation
* @return
*/
boolean isCompletedCourseUsedForGrad();
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.time.LocalDate;
import java.util.*;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -710,12 +711,13 @@ private List<TranscriptCourse> filterCourses(final List<TranscriptCourse> result
private TranscriptCourse getInterimCourse(
TranscriptCourse course,
final List<TranscriptCourse> results) {
//Check for dulicate courses
//Check for duplicate courses
for (final TranscriptCourse compareCourse : results) {
//Check and compare two courses for duplication and if required
//replace course based on requirement.
if (course.courseEquals(compareCourse)
&& course.compareCourse(compareCourse)) {
&& !course.isCompletedCourseUsedForGrad()
&& course.compareCourse(compareCourse) ) {
course = compareCourse;
}
}
Expand Down

0 comments on commit 8334ecd

Please sign in to comment.