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.22 #667

Merged
merged 10 commits into from
Jul 9, 2024
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.61</version>
<version>1.8.62</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 @@ -13,6 +13,7 @@
import java.time.Period;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;

public class EducGradStudentApiUtils {
Expand Down Expand Up @@ -107,10 +108,10 @@ public static HttpHeaders getHeaders (String accessToken)

public static String parsingTraxDate(String sessionDate) {
String actualSessionDate = sessionDate + "/01";
Date temp = new Date();
Date temp;
String sDates = null;
try {
temp = EducGradStudentApiUtils.parseDate(actualSessionDate, "yyyy/MM/dd");
temp = toLastDayOfMonth(EducGradStudentApiUtils.parseDate(actualSessionDate, "yyyy/MM/dd"));
sDates = EducGradStudentApiUtils.formatDate(temp, EducGradStudentApiConstants.DEFAULT_DATE_FORMAT);
} catch (ParseException pe) {
logger.error("ERROR: {}", pe.getMessage());
Expand All @@ -136,7 +137,7 @@ public static Date parsingProgramCompletionDate(String sessionDate) {
Date temp;
Date sDate = null;
try {
temp = EducGradStudentApiUtils.parseDate(actualSessionDate, EducGradStudentApiConstants.DATE_FORMAT);
temp = toLastDayOfMonth(EducGradStudentApiUtils.parseDate(actualSessionDate, EducGradStudentApiConstants.DATE_FORMAT));
String sDates = EducGradStudentApiUtils.formatDate(temp, EducGradStudentApiConstants.DATE_FORMAT);
sDate = EducGradStudentApiUtils.parseDate(sDates, EducGradStudentApiConstants.DATE_FORMAT);
} catch (ParseException pe) {
Expand Down Expand Up @@ -188,4 +189,14 @@ public static GradStatusEventPayloadDTO transform(GraduationStudentRecordEntity
.build();
}

static Date toLastDayOfMonth(Date date) {
if(date != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
return cal.getTime();
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;

import static ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants.SECOND_DEFAULT_DATE_FORMAT;

Expand Down Expand Up @@ -40,7 +41,7 @@ public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deser
if(slashCount > 0) {
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_FORMAT);
}
return LocalDate.parse(dateAsString, formatter);
return LocalDate.parse(dateAsString, formatter).with(TemporalAdjusters.lastDayOfMonth());
} else if(jsonParser.hasToken(JsonToken.VALUE_NUMBER_INT)) {
long timestamp = jsonParser.getValueAsLong();
return LocalDate.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;

import static ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants.*;

Expand Down Expand Up @@ -41,7 +42,7 @@ public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext d
if(slashCount > 0) {
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_FORMAT);
}
return LocalDateTime.parse(dateAsString, formatter);
return LocalDateTime.parse(dateAsString, formatter).with(TemporalAdjusters.lastDayOfMonth());
} else if(jsonParser.hasToken(JsonToken.VALUE_NUMBER_INT)) {
long timestamp = jsonParser.getValueAsLong();
return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
INSERT INTO HISTORY_ACTIVITY_CODE
(HISTORY_ACTIVITY_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
VALUES
('INSTITUTEALERT','Institute Alert','Alerts received from Institute when either school or district data has changed',270,
TIMESTAMP'2024-06-21 00:00:00.0',NULL);


INSERT INTO HISTORY_ACTIVITY_CODE
(HISTORY_ACTIVITY_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
VALUES
('PENALERT','PEN Alert','Alerts received from PEN when student demographic data has changed',280,
TIMESTAMP'2024-06-21 00:00:00.0',NULL);


INSERT INTO HISTORY_ACTIVITY_CODE
(HISTORY_ACTIVITY_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
VALUES
('COREGALERT','Coreg Alert','Alerts received from Coreg when course data has changed',290,
TIMESTAMP'2024-06-21 00:00:00.0',NULL);
Loading