Skip to content

Commit

Permalink
Merge pull request #503 from bcgov/grad-release
Browse files Browse the repository at this point in the history
Grad release 1.22
  • Loading branch information
githubmamatha authored Jul 9, 2024
2 parents aadb0e6 + bd47e27 commit f1e4169
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 5 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-batch-graduation-api</artifactId>
<version>1.8.65</version>
<version>1.8.66</version>
<name>educ-grad-batch-graduation-api</name>
<description>Ministry of Education GRAD BATCH GRADUATION API</description>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ca.bc.gov.educ.api.batchgraduation.util;

import ca.bc.gov.educ.api.batchgraduation.service.GradService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
Expand All @@ -11,6 +10,7 @@
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.Period;
import java.util.Calendar;
import java.util.Date;

public class EducGradBatchGraduationApiUtils {
Expand Down Expand Up @@ -63,7 +63,7 @@ public static Date parsingTraxDate(String sessionDate) {
try {
temp = EducGradBatchGraduationApiUtils.parseDate(actualSessionDate, EducGradBatchGraduationApiConstants.DATE_FORMAT);
String sDates = EducGradBatchGraduationApiUtils.formatDate(temp, EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT);
sDate = EducGradBatchGraduationApiUtils.parseDate(sDates, EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT);
sDate = toLastDayOfMonth(EducGradBatchGraduationApiUtils.parseDate(sDates, EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT));
} catch (ParseException pe) {
logger.error(ERROR_MSG,pe.getMessage());
}
Expand All @@ -88,5 +88,15 @@ public static String getProgramCompletionDate(Date pcd) {
DateFormat dateFormat = new SimpleDateFormat(EducGradBatchGraduationApiConstants.DEFAULT_DATE_FORMAT);
return dateFormat.format(pcd);
}

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 @@ -11,6 +11,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.batchgraduation.util.EducGradBatchGraduationApiConstants.SECOND_DEFAULT_DATE_FORMAT;

Expand All @@ -34,7 +35,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 @@ -12,6 +12,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.batchgraduation.util.EducGradBatchGraduationApiConstants.*;

Expand All @@ -35,7 +36,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,2 @@
INSERT INTO BATCH_JOB_TYPE_CODE (BATCH_JOB_TYPE_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
VALUES ('TVR_DELETE','Delete Student TVR Process','A year-end process that will delete student TVRs',120,TIMESTAMP'2024-06-24 00:00:00.0',NULL);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UPDATE BATCH_JOB_TYPE_CODE
SET DESCRIPTION='A year-end process that will set student status of CUR (current) and TER (terminated) to ARC (archived)', UPDATE_USER='API_GRAD_BATCH' , UPDATE_DATE=TIMESTAMP'2024-06-25 00:00:00.0'
WHERE BATCH_JOB_TYPE_CODE='ARC_STUDENTS';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO BATCH_JOB_TYPE_CODE (BATCH_JOB_TYPE_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
VALUES ('SCHL_RPT_REGEN','User Request School Report Regeneration','The User regenerate School Reports option allows Users to manually update school reports upon demand.',130,TIMESTAMP'2024-06-26 00:00:00.0',NULL);

0 comments on commit f1e4169

Please sign in to comment.