diff --git a/README.md b/README.md index d0cbd9f3b..94b50f2a0 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,11 @@ Users need to select at least one period of time, and users can click the “New Note: Charts will be generated only by selecting at least 2 time periods. -**Have two items of time period:** +**Have three items of time period:** -1. **Regular Calendar(Weekend Considered):** If you select this item, it means all data will exclude the weekend. +1. **Regular Calendar:** If you select this item, it means all data will exclude the weekend. 2. **Calendar with Chinese Holiday:** If you select this item, it means all data will exclude the weekend and Chinese holiday. So if the time period you selected contains Chinese holiday, you need to select this item. +3. **Calendar with Vietnam Holiday:** If you select this item, it means all data will exclude the weekend and Vietnam holiday. So if the time period you selected contains Vietnam holiday, you need to select this item. All need to select which data you want to get, for now, we support seven metrics data (Image 3-3). Those seven metrics are `Deployment Frequency (DF)`, `Lead Time for changes (LTC)`, `Mean Time To Recover (MTTR)`, `Change Failure Rate (CFR)`, and `Velocity`, `Cycle time`, `Classification`, where diff --git a/backend/src/main/java/heartbeat/service/report/VietnamHoliday.java b/backend/src/main/java/heartbeat/service/report/VietnamHoliday.java index 6d3e4941d..af0d20b43 100644 --- a/backend/src/main/java/heartbeat/service/report/VietnamHoliday.java +++ b/backend/src/main/java/heartbeat/service/report/VietnamHoliday.java @@ -37,7 +37,9 @@ public Map loadHolidayList(String year) { holidays.forEach(holiday -> { String date = holiday.getDate().getIso(); - holidayMap.put(date, holiday.getType().contains("National holiday")); + if (holiday.getType().contains("National holiday")) { + holidayMap.put(date, true); + } }); return holidayMap; } diff --git a/backend/src/test/java/heartbeat/service/report/VietnamHolidayTest.java b/backend/src/test/java/heartbeat/service/report/VietnamHolidayTest.java index c360d12dc..b06e736e2 100644 --- a/backend/src/test/java/heartbeat/service/report/VietnamHolidayTest.java +++ b/backend/src/test/java/heartbeat/service/report/VietnamHolidayTest.java @@ -16,11 +16,8 @@ import org.mockito.quality.Strictness; import java.util.Map; -import java.util.Objects; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -54,15 +51,7 @@ void loadHolidayListSuccess() throws Exception { Map result = vietnamHoliday.loadHolidayList(year); - assertEquals(6, result.size()); - for (String key : result.keySet()) { - if (Objects.equals(key, "2024-01-01")) { - assertTrue(result.get(key)); - } - else { - assertFalse(result.get(key)); - } - } + assertEquals(Map.of("2024-01-01", true), result); verify(calendarificFeignClient).getHolidays(country.getValue().toLowerCase(), year); verify(objectMapper).readValue(eq(calendarificHolidayResponseDTOString), any(Class.class)); } diff --git a/frontend/src/containers/ConfigStep/BasicInfo/index.tsx b/frontend/src/containers/ConfigStep/BasicInfo/index.tsx index 313879ef4..3334bdba0 100644 --- a/frontend/src/containers/ConfigStep/BasicInfo/index.tsx +++ b/frontend/src/containers/ConfigStep/BasicInfo/index.tsx @@ -8,8 +8,8 @@ import { ConfigSectionContainer } from '@src/components/Common/ConfigForms'; import { useAppDispatch, useAppSelector } from '@src/hooks/useAppDispatch'; import { ConfigSelectionTitle } from '@src/containers/MetricsStep/style'; import { CALENDAR_LABEL, CALENDAR_LIST } from '@src/constants/resources'; +import { FormControl, Radio, RadioGroup } from '@mui/material'; import { Controller, useFormContext } from 'react-hook-form'; -import { Radio, RadioGroup } from '@mui/material'; const BasicInfo = () => { const dispatch = useAppDispatch(); @@ -45,32 +45,34 @@ const BasicInfo = () => { )} /> - Collection Date(Weekend Considered) - { - return ( - { - field.onChange(e.target.value); - dispatch(updateCalendarType(e.target.value)); - }} - > - {CALENDAR_LIST.map((calendarType) => ( - } - name={CALENDAR_LABEL[calendarType]} - label={CALENDAR_LABEL[calendarType]} - /> - ))} - - ); - }} - /> + + Collection Date (Weekend Considered) + { + return ( + { + field.onChange(e.target.value); + dispatch(updateCalendarType(e.target.value)); + }} + > + {CALENDAR_LIST.map((calendarType) => ( + } + name={CALENDAR_LABEL[calendarType]} + label={CALENDAR_LABEL[calendarType]} + /> + ))} + + ); + }} + /> + diff --git a/frontend/src/containers/ConfigStep/BasicInfo/style.tsx b/frontend/src/containers/ConfigStep/BasicInfo/style.tsx index d8d48521b..a2f5de554 100644 --- a/frontend/src/containers/ConfigStep/BasicInfo/style.tsx +++ b/frontend/src/containers/ConfigStep/BasicInfo/style.tsx @@ -1,4 +1,4 @@ -import { FormControlLabel, TextField } from '@mui/material'; +import { FormControlLabel, FormLabel, TextField } from '@mui/material'; import { css, styled } from '@mui/material/styles'; import { theme } from '@src/theme'; @@ -16,10 +16,11 @@ export const StyledFormControlLabel = styled(FormControlLabel)` `} `; -export const CollectionDateLabel = styled('div')({ +export const CollectionDateLabel = styled(FormLabel)({ width: '100%', color: theme.palette.secondary.contrastText, - fontSize: '0.8rem', + fontSize: '0.75rem', lineHeight: '2em', boxSizing: 'border-box', + marginTop: '1rem', });