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

Grad release 1.16.0 #634

Merged
merged 7 commits into from
Mar 26, 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
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.55</version>
<version>1.8.56</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 @@ -87,4 +87,8 @@ void updateStudentGuidPenXrefRecord(
@Modifying
@Query("update GraduationStudentRecordEntity e set e.recalculateGradStatus = :recalculateGradStatus where e.studentID = :studentGuid")
void updateGradStudentRecalculationRecalculateGradStatusFlag(@Param(value = "studentGuid") UUID studentGuid, @Param(value = "recalculateGradStatus") String recalculateGradStatus);

@Modifying
@Query( "update GraduationStudentRecordEntity e set e.recalculateProjectedGrad = 'Y' where e.studentStatus = 'CUR' and e.programCompletionDate is null and (e.studentGrade = '12' or e.studentGrade = 'AD')")
void updateGradStudentRecalcFlagsForCurrentStudentsWithNullCompletion();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@
public interface StudentNoteRepository extends JpaRepository<StudentRecordNoteEntity, UUID> {

List<StudentRecordNoteEntity> findByStudentID(UUID studentId);

void deleteByStudentID(UUID studentID);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package ca.bc.gov.educ.api.gradstudent.scheduler;

import ca.bc.gov.educ.api.gradstudent.repository.GraduationStudentRecordRepository;
import jakarta.transaction.Transactional;
import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.core.LockAssert;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RefreshNonGradStatusScheduler {
private final GraduationStudentRecordRepository graduationStudentRecordRepository;

@Autowired
public RefreshNonGradStatusScheduler(GraduationStudentRecordRepository graduationStudentRecordRepository) {
this.graduationStudentRecordRepository = graduationStudentRecordRepository;
}

@Scheduled(cron = "${cron.scheduled.process.refresh-non-grad-status.run}")
@SchedulerLock(name = "refreshNonGradStatusLock",
lockAtLeastFor = "PT2M", lockAtMostFor = "PT5M")
@Transactional
public void refreshNonGradStatuses() {
LockAssert.assertLocked();
graduationStudentRecordRepository.updateGradStudentRecalcFlagsForCurrentStudentsWithNullCompletion();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants;
import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiUtils;
import ca.bc.gov.educ.api.gradstudent.util.GradValidation;
import ca.bc.gov.educ.api.gradstudent.util.ThreadLocalStateUtil;
import io.github.resilience4j.retry.annotation.Retry;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -51,6 +50,7 @@ public class DataConversionService {
final StudentOptionalProgramHistoryRepository gradStudentOptionalProgramHistoryRepository;
final GraduationStudentRecordHistoryRepository gradStudentRecordHistoryRepository;
final HistoryService historyService;
final StudentNoteRepository studentNoteRepository;

final GraduationStatusService graduationStatusService;
final GradValidation validation;
Expand All @@ -64,7 +64,7 @@ public DataConversionService(WebClient webClient,
StudentCareerProgramRepository gradStudentCareerProgramRepository, GradStudentCareerProgramTransformer gradStudentCareerProgramTransformer,
StudentOptionalProgramHistoryRepository gradStudentOptionalProgramHistoryRepository,
GraduationStudentRecordHistoryRepository gradStudentRecordHistoryRepository,
HistoryService historyService, GraduationStatusService graduationStatusService, GradValidation validation, EducGradStudentApiConstants constants) {
HistoryService historyService, StudentNoteRepository studentNoteRepository, GraduationStatusService graduationStatusService, GradValidation validation, EducGradStudentApiConstants constants) {
this.webClient = webClient;
this.graduationStatusRepository = graduationStatusRepository;
this.graduationStatusTransformer = graduationStatusTransformer;
Expand All @@ -75,6 +75,7 @@ public DataConversionService(WebClient webClient,
this.gradStudentOptionalProgramHistoryRepository = gradStudentOptionalProgramHistoryRepository;
this.gradStudentRecordHistoryRepository = gradStudentRecordHistoryRepository;
this.historyService = historyService;
this.studentNoteRepository = studentNoteRepository;
this.graduationStatusService = graduationStatusService;
this.validation = validation;
this.constants = constants;
Expand Down Expand Up @@ -215,6 +216,8 @@ public void deleteGraduationStatus(UUID studentID) {

@Transactional
public void deleteAllDependencies(UUID studentID) {
// student_record_note
studentNoteRepository.deleteByStudentID(studentID);
// student_career_program
gradStudentCareerProgramRepository.deleteByStudentID(studentID);
// student_optional_program_history
Expand Down
6 changes: 4 additions & 2 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ server:
worker: 128
io: 16
#port: ${HTTP_PORT}
tomcat:
connection-timeout: 200s
#tomcat:
#connection-timeout: 200s

#API Documentation
springdoc:
Expand Down Expand Up @@ -109,6 +109,8 @@ cron:
purge-old-records:
run: ${CRON_SCHEDULED_PURGE_OLD_RECORDS}
staleInDays: ${RECORDS_STALE_IN_DAYS}
refresh-non-grad-status:
run: ${CRON_SCHEDULED_REFRESH_NON_GRAD_STATUS}

#Resilience
resilience4j.retry:
Expand Down
2 changes: 2 additions & 0 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ cron:
purge-old-records:
run: 0 30 0 * * *
staleInDays: 90
refresh-non-grad-status:
run: 0 30 0 * * *

#Endpoint properties
endpoint:
Expand Down
20 changes: 20 additions & 0 deletions tools/config/override-configmap-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,28 @@ PARSER_CONFIG="
###########################################################
#Override config-maps in DEV
###########################################################
echo Creating config map "$APP_NAME"-config-map
oc create -n "$GRAD_NAMESPACE"-"$envValue" configmap "$APP_NAME"-config-map \
--from-literal=APP_LOG_LEVEL="$APP_LOG_LEVEL" \
--from-literal=CONNECTION_TIMEOUT="60000" \
--from-literal=EDUC_SCHOOL_API="http://school-api-master.$COMMON_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=ENABLE_FLYWAY="true" \
--from-literal=ENABLE_SPLUNK_LOG_HELPER="false" \
--from-literal=ENABLE_STUDENT_ID_PEN_XREF="true" \
--from-literal=ENABLE_TRAX_UPDATE="true" \
--from-literal=GRAD_GRADUATION_REPORT_API="http://educ-grad-graduation-report-api.$GRAD_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=GRAD_PROGRAM_API="http://educ-grad-program-api.$GRAD_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=GRAD_STUDENT_GRADUATION_API="http://educ-grad-student-graduation-api.$GRAD_NAMESPACE-$envValue.svc.cluster.local:8080/" \
--from-literal=GRAD_TRAX_API="http://educ-grad-trax-api.$GRAD_NAMESPACE-$envValue.svc.cluster.local:8080/"\
--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 * ? * *" \
--dry-run=client -o yaml | oc apply -f -

echo Creating config map "$APP_NAME"-flb-sc-config-map
oc create -n "$GRAD_NAMESPACE"-"$envValue" configmap "$APP_NAME"-flb-sc-config-map \
--from-literal=fluent-bit.conf="$FLB_CONFIG" \
--from-literal=parsers.conf="$PARSER_CONFIG" \
--from-literal=CRON_SCHEDULED_REFRESH_NON_GRAD_STATUS="0 */10 * ? * *"
--dry-run=client -o yaml | oc apply -f -
1 change: 1 addition & 0 deletions tools/config/update-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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 0 0 1 * ?" \
--dry-run=client -o yaml | oc apply -f -

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