Skip to content

Commit

Permalink
Merge pull request #646 from bcgov/grad-release
Browse files Browse the repository at this point in the history
Grad release 1.18.0
  • Loading branch information
githubmamatha authored Apr 24, 2024
2 parents 7a4ccd1 + 49737cf commit 23c3a6b
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 28 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-student-api</artifactId>
<version>1.8.57</version>
<version>1.8.58</version>
<name>educ-grad-student-api</name>
<description>Student Demographics API for GRAD team</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class GraduationStudentRecordDistribution extends BaseModel{
private String legalMiddleNames;
private String legalLastName;
private String schoolOfRecord;
private String schoolAtGrad;
private String programCompletionDate;
private String honoursStanding;
private String program;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public GraduationStudentRecordDistribution tToDForDistribution(GraduationStudent
distObj.setProgram(ent.getProgram());
distObj.setHonoursStanding(ent.getHonoursStanding());
distObj.setSchoolOfRecord(ent.getSchoolOfRecord());
distObj.setSchoolAtGrad(ent.getSchoolAtGrad());
distObj.setProgramCompletionDate(EducGradStudentApiUtils.parseDateFromString(gradStatusEntity.getProgramCompletionDate() != null ? gradStatusEntity.getProgramCompletionDate().toString():null));
distObj.setStudentID(ent.getStudentID());
distObj.setStudentCitizenship(ent.getStudentCitizenship());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public class GraduationStatusService {

private static final String CREATE_USER = "createUser";
private static final String CREATE_DATE = "createDate";
private static final String UPDATE_USER = "updateUser";
private static final String UPDATE_DATE = "updateDate";
private static final String GRAD_ALG = "GRADALG";
private static final String USER_EDIT = "USEREDIT";
private static final String USER_CREATE = "USEREDIT";
private static final String USER_DELETE = "USERDELETE";
private static final String USER_UNDO_CMPL = "USERUNDOCMPL";

private static final String STD_NOT_FOUND_MSG = "Student with ID: %s not found";

final
WebClient webClient;

Expand Down Expand Up @@ -127,7 +127,7 @@ public boolean hasStudentGraduated(UUID studentID) throws EntityNotFoundExceptio
GraduationStudentRecordEntity graduationStudentRecord = responseOptional.get();
return graduationStudentRecord.getProgramCompletionDate() != null;
}
throw new EntityNotFoundException(String.format("Student with ID: {} not found", studentID));
throw new EntityNotFoundException(String.format(STD_NOT_FOUND_MSG, studentID));
}

@Retry(name = "generalgetcall")
Expand Down Expand Up @@ -165,7 +165,7 @@ public GraduationStudentRecord getGraduationStatus(UUID studentID) throws Entity
if (responseOptional.isPresent()) {
return graduationStatusTransformer.transformToDTO(responseOptional.get());
}
throw new EntityNotFoundException(String.format("Student with ID: %s not found", studentID));
throw new EntityNotFoundException(String.format(STD_NOT_FOUND_MSG, studentID));
}

/**
Expand All @@ -179,7 +179,7 @@ public GraduationStudentRecordGradStatus getGraduationStatusProjection(UUID stud
if (response != null) {
return response;
}
throw new EntityNotFoundException(String.format("Student with ID: %s not found", studentID));
throw new EntityNotFoundException(String.format(STD_NOT_FOUND_MSG, studentID));
}

@Transactional
Expand Down Expand Up @@ -365,12 +365,9 @@ public GraduationStudentRecordSearchResult searchGraduationStudentRecords(final
if(!searchRequest.getDistricts().contains(school.getDistNo())) {
it.remove();
} else {
if(searchRequest.getSchoolCategoryCodes() != null && !searchRequest.getSchoolCategoryCodes().isEmpty()) {
if(!searchRequest.getSchoolCategoryCodes().contains(school.getSchoolCategoryCode())) {
it.remove();
} else {
searchRequest.getSchoolOfRecords().add(school.getDistNo() + school.getSchlNo());
}
List<String> schoolCategoryCodes = searchRequest.getSchoolCategoryCodes().stream().filter(StringUtils::isNotBlank).toList();
if(!schoolCategoryCodes.isEmpty() && !schoolCategoryCodes.contains(school.getSchoolCategoryCode())) {
it.remove();
} else {
searchRequest.getSchoolOfRecords().add(school.getDistNo() + school.getSchlNo());
}
Expand Down Expand Up @@ -697,15 +694,19 @@ && calculateAge(studentObj.getDob()) < 18) {

}

private void validateOptionalProgram(UUID optionalProgramID, String accessToken) {
if (optionalProgramID == null) {
validation.addErrorAndStop("Optional Program ID is required");
return;
}
private void validateOptionalProgram(UUID optionalProgramID, GraduationStudentRecord graduationStudentRecord, String accessToken) {

// check if op exists
OptionalProgram optionalProgram = getOptionalProgram(optionalProgramID, accessToken);
if (optionalProgram == null || isPrimaryKeyNull(optionalProgram)) {
validation.addNotFoundErrorAndStop(String.format("Optional Program with ID: %s not found", optionalProgramID));
return;
}

// check that op and program combination exists and that the op id matches
OptionalProgram optionalProgram1 = getOptionalProgram(graduationStudentRecord.getProgram(), optionalProgram.getOptProgramCode(), accessToken);
if (optionalProgram1 == null || !optionalProgram1.getOptionalProgramID().equals(optionalProgramID)) {
validation.addErrorAndStop(String.format("Cannot add optional program: %s to student as it is not available under the program: %s", optionalProgram.getOptionalProgramName(), graduationStudentRecord.getProgram()));
}
}

Expand Down Expand Up @@ -779,7 +780,7 @@ private void deleteStudentOptionalPrograms(UUID studentID) {
List<StudentOptionalProgramEntity> studOpList = gradStudentOptionalProgramRepository.findByStudentID(studentID);
if(!studOpList.isEmpty()) {
for (StudentOptionalProgramEntity studentOptionalProgramEntity : studOpList) {
historyService.createStudentOptionalProgramHistory(studentOptionalProgramEntity,"USERDELETE");
historyService.createStudentOptionalProgramHistory(studentOptionalProgramEntity,USER_DELETE);
gradStudentOptionalProgramRepository.deleteById(studentOptionalProgramEntity.getId());
}
}
Expand All @@ -789,13 +790,6 @@ private void deleteStudentCareerPrograms(UUID studentID) {
gradStudentCareerProgramRepository.deleteByStudentID(studentID);
}

private String getHonoursFlag(String gPA) {
if (Float.parseFloat(gPA) > 3)
return "Y";
else
return "N";
}

public List<StudentOptionalProgram> getStudentGradOptionalProgram(UUID studentID, String accessToken) {
List<StudentOptionalProgram> optionalProgramList =
gradStudentOptionalProgramTransformer.transformToDTO(gradStudentOptionalProgramRepository.findByStudentID(studentID));
Expand Down Expand Up @@ -842,7 +836,7 @@ public StudentOptionalProgram createStudentOptionalProgram(UUID studentID, UUID
// Validation
GraduationStudentRecord graduationStudentRecord = getGraduationStatus(studentID);
validateStudent(graduationStudentRecord);
validateOptionalProgram(optionalProgramID, accessToken);
validateOptionalProgram(optionalProgramID, graduationStudentRecord, accessToken);

// Process
StudentOptionalProgramEntity entity = persistStudentOptionalProgramWithAuditHistory(studentID, optionalProgramID);
Expand Down Expand Up @@ -878,7 +872,6 @@ public void deleteStudentOptionalProgram(UUID studentID, UUID optionalProgramID,
// Validation
GraduationStudentRecord graduationStudentRecord = getGraduationStatus(studentID);
validateStudent(graduationStudentRecord);
validateOptionalProgram(optionalProgramID, accessToken);

// Process
removeStudentOptionalProgramWithAuditHistory(studentID, optionalProgramID);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE EDW_GRADUATION_SNAPSHOT ADD SCHOOL_OF_RECORD_ID RAW(16);

ALTER TABLE GRADUATION_STUDENT_RECORD ADD SCHOOL_OF_RECORD_ID RAW(16);
ALTER TABLE GRADUATION_STUDENT_RECORD ADD SCHOOL_AT_GRADUATION_ID RAW(16);

ALTER TABLE GRADUATION_STUDENT_RECORD_HISTORY ADD SCHOOL_OF_RECORD_ID RAW(16);
ALTER TABLE GRADUATION_STUDENT_RECORD_HISTORY ADD SCHOOL_AT_GRADUATION_ID RAW(16);
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
DROP VIEW REPORT_GRAD_STUDENT_DATA_VW;

CREATE OR REPLACE VIEW REPORT_GRAD_STUDENT_DATA_VW AS
SELECT
A1.GRADUATION_STUDENT_RECORD_ID,
A1.SCHOOL_OF_RECORD MINCODE,
A1.SCHOOL_AT_GRADUATION MINCODE_AT_GRAD,
SUBSTR(A1.SCHOOL_OF_RECORD, 0, 3) DISTRICT_CODE,
SUBSTR(A1.SCHOOL_AT_GRADUATION, 0, 3) DISTRICT_CODE_AT_GRAD,
A1.STUDENT_STATUS_CODE STATUS,
A1.UPDATE_DATE,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStudent.pen' RETURNING VARCHAR2(10) DEFAULT 'error' ON ERROR) PEN,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStudent.legalFirstName' RETURNING VARCHAR2(64) DEFAULT 'error' ON ERROR) FIRST_NAME,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStudent.legalMiddleNames' RETURNING VARCHAR2(64) DEFAULT 'error' ON ERROR) MIDDLE_NAME,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStudent.legalLastName' RETURNING VARCHAR2(64) DEFAULT 'error' ON ERROR) LAST_NAME,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStudent.studentGrade' RETURNING VARCHAR2(64) DEFAULT 'error' ON ERROR) GRADE,
--JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStudent.studentStatus' RETURNING VARCHAR2(64) DEFAULT 'error' ON ERROR) STATUS,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.districtName' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) DISTRICT_NAME,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.schoolName' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_NAME,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.address1' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_ADDRESS1,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.address2' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_ADDRESS2,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.city' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_CITY,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.provCode' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_PROVINCE,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.countryName' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_COUNTRY,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.school.postal' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) SCHOOL_POSTAL,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradProgram.programCode' RETURNING VARCHAR2(64) DEFAULT 'error' ON ERROR) PROGRAM_CODE,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradProgram.programName' RETURNING VARCHAR2(128) DEFAULT 'error' ON ERROR) PROGRAM_NAME,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStatus.programCompletionDate' RETURNING VARCHAR2(10) DEFAULT 'error' ON ERROR) PROGRAM_COMPLETION_DATE,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.gradStatus.honoursStanding' RETURNING VARCHAR2(10) DEFAULT 'error' ON ERROR) HONORS_STANDING,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.graduated' RETURNING VARCHAR2(10) DEFAULT 'error' ON ERROR) IS_GRADUATED,
JSON_VALUE(A1.STUDENT_GRAD_DATA, '$.studentCertificatesTranscript.transcriptTypeCode' RETURNING VARCHAR2(16) DEFAULT '' ON ERROR) TRANSCRIPT_TYPE_CODE,
JSON_QUERY(A1.STUDENT_GRAD_DATA, '$.studentCertificatesTranscript.certificateTypeCodes') CERTIFICATE_TYPE_CODES,
JSON_QUERY(A1.STUDENT_GRAD_DATA, '$.studentCourses.studentCourseList.courseName' WITH WRAPPER) STUDENT_COURSES,
--DECODE(LENGTH(JSON_QUERY(A1.STUDENT_GRAD_DATA, '$.studentCourses.studentCourseList.courseName' WITH CONDITIONAL WRAPPER)), 0, 'N', 'Y') HAS_STUDENT_COURSES,
JSON_QUERY(A1.STUDENT_GRAD_DATA, '$.nonGradReasons') NON_GRAD_REASONS
FROM
API_GRAD_STUDENT.GRADUATION_STUDENT_RECORD A1
WHERE A1.STUDENT_STATUS_CODE NOT IN ('TER', 'DEC')

;


Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE OR REPLACE VIEW REPORT_GRAD_SCHOOL_YE_VW AS
SELECT
COUNT(GRADUATION_STUDENT_RECORD_ID) STUD_NUM,
SUBSTR(DECODE(A1.SCHOOL_AT_GRADUATION, NULL, A1.SCHOOL_OF_RECORD, A1.SCHOOL_AT_GRADUATION), 0, 3) MINCODE
FROM
GRADUATION_STUDENT_RECORD A1
WHERE
A1.PROGRAM_COMPLETION_DATE is null
AND A1.STUDENT_STATUS_CODE = 'CUR'
AND (A1.STUDENT_GRADE ='AD' or A1.STUDENT_GRADE='12')
GROUP BY SUBSTR(DECODE(A1.SCHOOL_AT_GRADUATION, NULL, A1.SCHOOL_OF_RECORD, A1.SCHOOL_AT_GRADUATION), 0, 3)
ORDER BY 1 DESC;

CREATE OR REPLACE VIEW REPORT_GRAD_DISTRICT_YE_VW AS
SELECT DISTINCT
SUBSTR(DECODE(A1.SCHOOL_AT_GRADUATION, NULL, A1.SCHOOL_OF_RECORD, A1.SCHOOL_AT_GRADUATION), 0, 3) MINCODE
FROM
GRADUATION_STUDENT_RECORD A1
WHERE
A1.PROGRAM_COMPLETION_DATE is null
AND A1.STUDENT_STATUS_CODE = 'CUR'
AND (A1.STUDENT_GRADE ='AD' or A1.STUDENT_GRADE='12')
GROUP BY SUBSTR(DECODE(A1.SCHOOL_AT_GRADUATION, NULL, A1.SCHOOL_OF_RECORD, A1.SCHOOL_AT_GRADUATION), 0, 3)
ORDER BY 1 DESC;


2 changes: 1 addition & 1 deletion tools/config/override-configmap-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ oc create -n "$GRAD_NAMESPACE"-"$envValue" configmap "$APP_NAME"-config-map \
--from-literal=MAXIMUM_POOL_SIZE="20" \
--from-literal=MAX_RETRY_ATTEMPTS="3" \
--from-literal=PEN_API="http://student-api-master.$COMMON_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=CRON_SCHEDULED_REFRESH_NON_GRAD_STATUS="0 */10 * ? * *" \
--from-literal=CRON_SCHEDULED_REFRESH_NON_GRAD_STATUS="0 0 0 1 * ?" \
--dry-run=client -o yaml | oc apply -f -

echo Creating config map "$APP_NAME"-flb-sc-config-map
Expand Down

0 comments on commit 23c3a6b

Please sign in to comment.