Skip to content

Commit

Permalink
chore: fix typos (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Campos authored Jun 14, 2024
1 parent aef2c63 commit 980c826
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import ca.bc.gov.restapi.results.oracle.dto.DashboardStockingEventDto;
import java.util.List;

/** This recor holds all data extracted from Oracle to be inserted on Postgres. */
/** This record holds all data extracted from Oracle to be inserted on Postgres. */
public record OracleExtractionDto(
List<DashboardOpeningDto> mainOpenings,
List<DashboardOpeningSubmissionDto> openingSubmissions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import java.time.LocalDateTime;

/** This record holds messages and its local date time when it happended. */
/** This record holds messages and its local date time when it happened. */
public record OracleLogDto(String message, LocalDateTime eventTime) {}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Optional<UserInfo> getUserInfo() {
}

lastName = parts[0].trim();
// Remove 'de' or other starting characteres before space
// Remove 'de' or other starting characters before space
if (lastName.contains(" ")) {
lastName = lastName.split(" ")[1].trim();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public void extractDataForTheDashboard(Integer months, Boolean debug, Boolean ma
String message = "Starting extraction";
log.info(message);

OracleExtractionDto extactionDto = oracleExtractionService.getOpeningActivities(params);
OracleExtractionDto extractionDto = oracleExtractionService.getOpeningActivities(params);

// Add the first log message
extactionDto.logMessages().add(0, new OracleLogDto(message, startDateTime));
extractionDto.logMessages().add(0, new OracleLogDto(message, startDateTime));

dashboardInsertionService.loadDashboardData(extactionDto, startDateTime, params);
dashboardInsertionService.loadDashboardData(extractionDto, startDateTime, params);
}

private OracleExtractionParamsDto getParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public PaginatedResult<RecentOpeningDto> getRecentOpeningsCurrentUser(
*/
public PaginatedResult<RecentOpeningDto> getRecentOpenings(PaginationParameters pagination) {
log.info(
"Getting recent openings, user independnt, with page index {} and page size {}",
"Getting recent openings, user independent, with page index {} and page size {}",
pagination.page(),
pagination.perPage());

Expand Down Expand Up @@ -129,8 +129,8 @@ public PaginatedResult<RecentOpeningDto> getRecentOpenings(PaginationParameters
}

private List<RecentOpeningDto> createDtoFromEntity(
List<OpeningEntity> openings, List<CutBlockOpenAdminEntity> clutBloks) {
if (openings.size() != clutBloks.size()) {
List<OpeningEntity> openings, List<CutBlockOpenAdminEntity> cutBlocks) {
if (openings.size() != cutBlocks.size()) {
log.warn("Different number of records for the Opening x Cut Block Open Admin relationship");
}

Expand All @@ -146,8 +146,8 @@ private List<RecentOpeningDto> createDtoFromEntity(
BigDecimal openingGrossArea = BigDecimal.ZERO;
LocalDate disturbanceStartDate = null;

if (clutBloks.size() - 1 >= i) {
CutBlockOpenAdminEntity cutBlockOpenAdmin = clutBloks.get(i);
if (cutBlocks.size() - 1 >= i) {
CutBlockOpenAdminEntity cutBlockOpenAdmin = cutBlocks.get(i);
forestFileId = cutBlockOpenAdmin.getForestFileId();
cuttingPermitId = cutBlockOpenAdmin.getCuttingPermitId();
timberMark = cutBlockOpenAdmin.getTimberMark();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.time.LocalDateTime;

/** This record contains all possible filters for the dashboard openings per years api. */
public record DashboardFiltesDto(
public record DashboardFiltersDto(
String orgUnit,
String status,
LocalDateTime entryDateStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Tag(
name = "Dashboard Extraction (SILVA)",
description = "Endpoints fot the Dashboard extraction process in the `SILVA` schema")
public class DashboardExtractionEnpoint {
public class DashboardExtractionEndpoint {

private final OracleExtractionLogsRepository oracleExtractionLogsRepository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ca.bc.gov.restapi.results.postgres.endpoint;

import ca.bc.gov.restapi.results.common.util.TimestampUtil;
import ca.bc.gov.restapi.results.postgres.dto.DashboardFiltesDto;
import ca.bc.gov.restapi.results.postgres.dto.DashboardFiltersDto;
import ca.bc.gov.restapi.results.postgres.dto.FreeGrowingMilestonesDto;
import ca.bc.gov.restapi.results.postgres.dto.MyRecentActionsRequestsDto;
import ca.bc.gov.restapi.results.postgres.dto.OpeningsPerYearDto;
Expand Down Expand Up @@ -72,28 +72,28 @@ public ResponseEntity<List<OpeningsPerYearDto>> getOpeningsSubmissionTrends(
@Parameter(
name = "statusCode",
in = ParameterIn.QUERY,
description = "The Openins Status code to filter",
description = "The Openings Status code to filter",
required = false,
example = "APP")
String statusCode,
@RequestParam(value = "entryDateStart", required = false)
@Parameter(
name = "entryDateStart",
in = ParameterIn.QUERY,
description = "The Openins entry timestamp start date to filter, format yyyy-MM-dd",
description = "The Openings entry timestamp start date to filter, format yyyy-MM-dd",
required = false,
example = "2024-03-11")
String entryDateStart,
@RequestParam(value = "entryDateEnd", required = false)
@Parameter(
name = "entryDateEnd",
in = ParameterIn.QUERY,
description = "The Openins entry timestamp end date to filter, format yyyy-MM-dd",
description = "The Openings entry timestamp end date to filter, format yyyy-MM-dd",
required = false,
example = "2024-03-11")
String entryDateEnd) {
DashboardFiltesDto filtersDto =
new DashboardFiltesDto(
DashboardFiltersDto filtersDto =
new DashboardFiltersDto(
orgUnitCode,
statusCode,
TimestampUtil.parseDateString(entryDateStart),
Expand Down Expand Up @@ -159,20 +159,20 @@ public ResponseEntity<List<FreeGrowingMilestonesDto>> getFreeGrowingMilestonesDa
@Parameter(
name = "entryDateStart",
in = ParameterIn.QUERY,
description = "The Openins entry timestamp start date to filter, format yyyy-MM-dd",
description = "The Openings entry timestamp start date to filter, format yyyy-MM-dd",
required = false,
example = "2024-03-11")
String entryDateStart,
@RequestParam(value = "entryDateEnd", required = false)
@Parameter(
name = "entryDateEnd",
in = ParameterIn.QUERY,
description = "The Openins entry timestamp end date to filter, format yyyy-MM-dd",
description = "The Openings entry timestamp end date to filter, format yyyy-MM-dd",
required = false,
example = "2024-03-11")
String entryDateEnd) {
DashboardFiltesDto filtersDto =
new DashboardFiltesDto(
DashboardFiltersDto filtersDto =
new DashboardFiltersDto(
orgUnitCode,
null,
TimestampUtil.parseDateString(entryDateStart),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DashboardInsertionService {
private static final String INCONSISTENCY = "DEBUG mode ON! Possible data inconsistency found!";

/**
* Loads all data extraced from Oracle into Postgres.
* Loads all data extracted from Oracle into Postgres.
*
* @param oracleDto A {@link OracleExtractionDto} containing all data
*/
Expand Down Expand Up @@ -88,7 +88,7 @@ private void saveLogs(
private void saveOpeningsActivities(OracleExtractionDto oracleDto, Boolean debug) {
logAndSave(
oracleDto.logMessages(),
"Cleaning up opening acitivites (SILVA.OPENINGS_ACTIVITY on Postgres)");
"Cleaning up opening activities (SILVA.OPENINGS_ACTIVITY on Postgres)");
openingsActivityRepository.deleteAll();
openingsActivityRepository.flush();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import ca.bc.gov.restapi.results.common.security.LoggedUserService;
import ca.bc.gov.restapi.results.common.util.TimestampUtil;
import ca.bc.gov.restapi.results.postgres.dto.DashboardFiltesDto;
import ca.bc.gov.restapi.results.postgres.dto.DashboardFiltersDto;
import ca.bc.gov.restapi.results.postgres.dto.FreeGrowingMilestonesDto;
import ca.bc.gov.restapi.results.postgres.dto.MyRecentActionsRequestsDto;
import ca.bc.gov.restapi.results.postgres.dto.OpeningsPerYearDto;
Expand Down Expand Up @@ -41,10 +41,10 @@ public class DashboardMetricsService {
/**
* Get openings submission trends data for the opening per year chart.
*
* @param filters Possible filter, see {@link DashboardFiltesDto} for more.
* @param filters Possible filter, see {@link DashboardFiltersDto} for more.
* @return A list of {@link OpeningsPerYearDto} for the opening chart.
*/
public List<OpeningsPerYearDto> getOpeningsSubmissionTrends(DashboardFiltesDto filters) {
public List<OpeningsPerYearDto> getOpeningsSubmissionTrends(DashboardFiltersDto filters) {
log.info("Getting Opening Submission Trends with filters {}", filters.toString());

LocalDateTime baseDateTime = LocalDateTime.now().minusMonths(12);
Expand Down Expand Up @@ -77,7 +77,7 @@ public List<OpeningsPerYearDto> getOpeningsSubmissionTrends(DashboardFiltesDto f
private void filterOpeningSubmissions(
Map<Integer, List<OpeningsLastYearEntity>> resultMap,
List<OpeningsLastYearEntity> entities,
DashboardFiltesDto filters) {
DashboardFiltersDto filters) {
// Iterate over the found records filtering and putting them into the right month
for (OpeningsLastYearEntity entity : entities) {
// Org Unit filter - District
Expand Down Expand Up @@ -132,11 +132,11 @@ private Map<Integer, List<OpeningsLastYearEntity>> createBaseMonthsMap(
/**
* Get free growing milestone declarations data for the chart.
*
* @param filters Possible filter, see {@link DashboardFiltesDto} for more.
* @param filters Possible filter, see {@link DashboardFiltersDto} for more.
* @return A list of {@link FreeGrowingMilestonesDto} for the chart.
*/
public List<FreeGrowingMilestonesDto> getFreeGrowingMilestoneChartData(
DashboardFiltesDto filters) {
DashboardFiltersDto filters) {
log.info("Getting Free growing milestones with filters {}", filters.toString());

List<OpeningsLastYearEntity> entities =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;

@WebMvcTest(DashboardExtractionEnpoint.class)
@WebMvcTest(DashboardExtractionEndpoint.class)
@WithMockUser
class DashboardExtractionEnpointTest {
class DashboardExtractionEndpointTest {

@Autowired private MockMvc mockMvc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import ca.bc.gov.restapi.results.postgres.dto.DashboardFiltesDto;
import ca.bc.gov.restapi.results.postgres.dto.DashboardFiltersDto;
import ca.bc.gov.restapi.results.postgres.dto.FreeGrowingMilestonesDto;
import ca.bc.gov.restapi.results.postgres.dto.MyRecentActionsRequestsDto;
import ca.bc.gov.restapi.results.postgres.dto.OpeningsPerYearDto;
Expand Down Expand Up @@ -36,7 +36,7 @@ class DashboardMetricsEndpointTest {
@Test
@DisplayName("Opening submission trends with no filters should succeed")
void getOpeningsSubmissionTrends_noFilters_shouldSucceed() throws Exception {
DashboardFiltesDto filtersDto = new DashboardFiltesDto(null, null, null, null, null);
DashboardFiltersDto filtersDto = new DashboardFiltersDto(null, null, null, null, null);

OpeningsPerYearDto dto = new OpeningsPerYearDto(1, "Jan", 70);
when(dashboardMetricsService.getOpeningsSubmissionTrends(filtersDto)).thenReturn(List.of(dto));
Expand All @@ -58,7 +58,7 @@ void getOpeningsSubmissionTrends_noFilters_shouldSucceed() throws Exception {
@Test
@DisplayName("Opening submission trends with no data should succeed")
void getOpeningsSubmissionTrends_orgUnitFilter_shouldSucceed() throws Exception {
DashboardFiltesDto filtersDto = new DashboardFiltesDto("DCR", null, null, null, null);
DashboardFiltersDto filtersDto = new DashboardFiltersDto("DCR", null, null, null, null);

when(dashboardMetricsService.getOpeningsSubmissionTrends(filtersDto)).thenReturn(List.of());

Expand All @@ -75,7 +75,7 @@ void getOpeningsSubmissionTrends_orgUnitFilter_shouldSucceed() throws Exception
@Test
@DisplayName("Free growing milestones test with no filters should succeed")
void getFreeGrowingMilestonesData_noFilters_shouldSucceed() throws Exception {
DashboardFiltesDto filtersDto = new DashboardFiltesDto(null, null, null, null, null);
DashboardFiltersDto filtersDto = new DashboardFiltersDto(null, null, null, null, null);

FreeGrowingMilestonesDto milestonesDto =
new FreeGrowingMilestonesDto(0, "0 - 5 months", 25, new BigDecimal("100"));
Expand Down Expand Up @@ -106,7 +106,7 @@ void getFreeGrowingMilestonesData_clientNumberFilter_shouldSucceed() throws Exce
dtoList.add(new FreeGrowingMilestonesDto(2, "12 - 17 months", 25, new BigDecimal("25")));
dtoList.add(new FreeGrowingMilestonesDto(3, "18 months", 25, new BigDecimal("25")));

DashboardFiltesDto filtersDto = new DashboardFiltesDto(null, null, null, null, "00012797");
DashboardFiltersDto filtersDto = new DashboardFiltersDto(null, null, null, null, "00012797");

when(dashboardMetricsService.getFreeGrowingMilestoneChartData(filtersDto)).thenReturn(dtoList);

Expand Down Expand Up @@ -140,7 +140,7 @@ void getFreeGrowingMilestonesData_clientNumberFilter_shouldSucceed() throws Exce
@Test
@DisplayName("Free growing milestones test with no content should succeed")
void getFreeGrowingMilestonesData_noData_shouldSucceed() throws Exception {
DashboardFiltesDto filtersDto = new DashboardFiltesDto(null, null, null, null, "00012579");
DashboardFiltersDto filtersDto = new DashboardFiltersDto(null, null, null, null, "00012579");

when(dashboardMetricsService.getFreeGrowingMilestoneChartData(filtersDto))
.thenReturn(List.of());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class UserOpeningEndpointTest {

@Test
@DisplayName("Get user tracked openings happy path should succeed")
void getUserTrackedOpenings_happyPath_shoudSucceed() throws Exception {
void getUserTrackedOpenings_happyPath_shouldSucceed() throws Exception {
MyRecentActionsRequestsDto action =
new MyRecentActionsRequestsDto(
"Update", 123456L, "APP", "Approved", "2 minutes ago", LocalDateTime.now());
Expand All @@ -54,7 +54,7 @@ void getUserTrackedOpenings_happyPath_shoudSucceed() throws Exception {

@Test
@DisplayName("Get user tracked openings no data should succeed")
void getUserTrackedOpenings_noData_shoudSucceed() throws Exception {
void getUserTrackedOpenings_noData_shouldSucceed() throws Exception {
when(userOpeningService.getUserTrackedOpenings()).thenReturn(List.of());

mockMvc
Expand All @@ -67,15 +67,15 @@ void getUserTrackedOpenings_noData_shoudSucceed() throws Exception {
.andReturn();
}

void saveUserOpening_happyPath_shoudSucceed() throws Exception {
void saveUserOpening_happyPath_shouldSucceed() throws Exception {
//
}

void deleteUserOpening_happyPath_shoudSucceed() throws Exception {
void deleteUserOpening_happyPath_shouldSucceed() throws Exception {
//
}

void deleteUserOpening_notFound_shoudFail() throws Exception {
void deleteUserOpening_notFound_shouldFail() throws Exception {
//
}
}
Loading

0 comments on commit 980c826

Please sign in to comment.