Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop/alex grad2 2377 #475

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ca.bc.gov.educ.api.batchgraduation.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.io.Serializable;
Expand Down Expand Up @@ -27,4 +28,10 @@ public class StudentCredentialDistribution implements Serializable {
private String studentGrade;
private List<GradRequirement> nonGradReasons;

//For debug purpose only
@JsonIgnore
private String schoolAtGrad;
@JsonIgnore
private String schoolOfRecordOrigin;

}
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,23 @@ void filterByStudentSearchRequest(List<StudentCredentialDistribution> eligibleSt
}
}
eligibleStudentSchoolDistricts.removeIf(scr->StringUtils.isNotBlank(scr.getSchoolOfRecord()) && !useFilterSchoolDistricts.contains(scr.getSchoolOfRecord()));
LOGGER.debug("Student Credential Distribution filtered by schoolCategory code {}: ", searchRequest.getSchoolCategoryCodes());
}
if(searchRequest != null && searchRequest.getDistricts() != null && !searchRequest.getDistricts().isEmpty()) {
eligibleStudentSchoolDistricts.removeIf(scr->StringUtils.isNotBlank(scr.getSchoolOfRecord()) && !searchRequest.getDistricts().contains(StringUtils.substring(scr.getSchoolOfRecord(), 0, 3)));
LOGGER.debug("Student Credential Distribution filtered by district code {}: ", searchRequest.getDistricts());
}
if(searchRequest != null && searchRequest.getSchoolOfRecords() != null && !searchRequest.getSchoolOfRecords().isEmpty()) {
eligibleStudentSchoolDistricts.removeIf(scr->StringUtils.isNotBlank(scr.getSchoolOfRecord()) && !searchRequest.getSchoolOfRecords().contains(scr.getSchoolOfRecord()));
LOGGER.debug("Student Credential Distribution filtered by schoolOfRecord code {}: ", searchRequest.getSchoolOfRecords());
}
if(searchRequest != null && searchRequest.getStudentIDs() != null && !searchRequest.getStudentIDs().isEmpty()) {
eligibleStudentSchoolDistricts.removeIf(scr->scr.getStudentID() != null && !searchRequest.getStudentIDs().contains(scr.getStudentID()));
LOGGER.debug("Student Credential Distribution filtered by student ID {}: ", searchRequest.getStudentIDs());
}
if(searchRequest != null && searchRequest.getPens() != null && !searchRequest.getPens().isEmpty()) {
eligibleStudentSchoolDistricts.removeIf(scr->StringUtils.isNotBlank(scr.getPen()) && !searchRequest.getPens().contains(scr.getPen()));
LOGGER.debug("Student Credential Distribution filtered by pen {}: ", searchRequest.getPens());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import ca.bc.gov.educ.api.batchgraduation.model.StudentCredentialDistribution;
import ca.bc.gov.educ.api.batchgraduation.util.EducGradBatchGraduationApiConstants;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Service;
Expand All @@ -18,6 +20,8 @@
@Service
public class GraduationReportService {

private static final Logger LOGGER = LoggerFactory.getLogger(GraduationReportService.class);

@Autowired
WebClient webClient;

Expand Down Expand Up @@ -99,6 +103,8 @@ private StudentCredentialDistribution populateStudentCredentialDistribution(Repo
dist.setStudentID(data.getGraduationStudentRecordId());
dist.setPaperType(paperType);
dist.setSchoolOfRecord(StringUtils.isBlank(data.getMincodeAtGrad()) ? data.getMincode() : data.getMincodeAtGrad());
dist.setSchoolAtGrad(data.getMincodeAtGrad());
dist.setSchoolOfRecordOrigin(data.getMincode());
dist.setDocumentStatusCode("COMPL");
dist.setPen(data.getPen());
dist.setLegalFirstName(data.getFirstName());
Expand All @@ -110,6 +116,7 @@ private StudentCredentialDistribution populateStudentCredentialDistribution(Repo
dist.setStudentGrade(data.getStudentGrade());
dist.setNonGradReasons(data.getNonGradReasons());
dist.setLastUpdateDate(data.lastUpdateDateAsString());
LOGGER.info("Populate Student Credential Distribution for pen {}: SchoolOfRecordOrigin->{}, SchoolAtGrad->{}, SchoolOfRecord->{}", dist.getPen(), dist.getSchoolOfRecordOrigin(), dist.getSchoolAtGrad(), dist.getSchoolOfRecord());
return dist;
}
}
Loading