From a2f24cd5b6f7bb0e76a1a53b8e37cde1276c60d3 Mon Sep 17 00:00:00 2001 From: KWY Date: Fri, 2 Aug 2024 11:42:52 +0900 Subject: [PATCH 1/5] =?UTF-8?q?#293=20[feat]=20duration=20=EB=A7=A4?= =?UTF-8?q?=EA=B0=9C=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 회의 진행 시간 별 긴 블록을 구분하는 로직을 계산하기 위해 매개변수에 duration을 추가했습니다 --- .../service/meeting/recommend/MeetingTimeRecommendService.java | 2 +- .../meeting/recommend/strategy/BestMeetingTimeStrategy.java | 3 ++- .../recommend/strategy/impl/BestMeetingTimeStrategyImpl.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/asap/server/service/meeting/recommend/MeetingTimeRecommendService.java b/src/main/java/com/asap/server/service/meeting/recommend/MeetingTimeRecommendService.java index 19d0dd16..547da17a 100644 --- a/src/main/java/com/asap/server/service/meeting/recommend/MeetingTimeRecommendService.java +++ b/src/main/java/com/asap/server/service/meeting/recommend/MeetingTimeRecommendService.java @@ -34,7 +34,7 @@ public List getBestMeetingTime( List candidateMeetingTimes = new ArrayList<>( continuousMeetingTimeStrategy.find(timeBlocksFilteredUserCount, timeCase.duration())); - candidateMeetingTimes = bestMeetingTimeStrategy.find(candidateMeetingTimes); + candidateMeetingTimes = bestMeetingTimeStrategy.find(candidateMeetingTimes, timeCase.duration()); bestMeetingTimes.addAll(candidateMeetingTimes); if (bestMeetingTimes.size() < BEST_MEETING_TIME_SIZE) { diff --git a/src/main/java/com/asap/server/service/meeting/recommend/strategy/BestMeetingTimeStrategy.java b/src/main/java/com/asap/server/service/meeting/recommend/strategy/BestMeetingTimeStrategy.java index 77387bcc..ba2378d2 100644 --- a/src/main/java/com/asap/server/service/meeting/recommend/strategy/BestMeetingTimeStrategy.java +++ b/src/main/java/com/asap/server/service/meeting/recommend/strategy/BestMeetingTimeStrategy.java @@ -1,8 +1,9 @@ package com.asap.server.service.meeting.recommend.strategy; +import com.asap.server.persistence.domain.enums.Duration; import com.asap.server.service.vo.BestMeetingTimeVo; import java.util.List; public interface BestMeetingTimeStrategy { - List find(List candidateMeetingTimes); + List find(List candidateMeetingTimes, Duration duration); } diff --git a/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java b/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java index 7859ca60..b756880c 100644 --- a/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java +++ b/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java @@ -8,7 +8,7 @@ @Component public class BestMeetingTimeStrategyImpl implements BestMeetingTimeStrategy { @Override - public List find(List candidateMeetingTimes) { return null; + public List find(List candidateMeetingTimes, Duration duration) { } } From 204c3ebe0401b870cb30162db43cf7093185015d Mon Sep 17 00:00:00 2001 From: KWY Date: Fri, 2 Aug 2024 13:39:29 +0900 Subject: [PATCH 2/5] =?UTF-8?q?#293=20[test]=20=ED=9A=8C=EC=9D=98=20?= =?UTF-8?q?=EC=A7=84=ED=96=89=20=EC=8B=9C=EA=B0=84=EB=A7=88=EB=8B=A4=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 각 회의 진행 시간마다 최적의 회의 시간을 1개 반환하는 테스트 케이스 최적의 회의 시간을 2개 반환하는 테스트 케이스 --- .../impl/BestMeetingTimeStrategyImplTest.java | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java diff --git a/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java b/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java new file mode 100644 index 00000000..e4f8a325 --- /dev/null +++ b/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java @@ -0,0 +1,288 @@ +package com.asap.server.service.meeting.recommend.strategy.impl; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +import com.asap.server.persistence.domain.enums.Duration; +import com.asap.server.persistence.domain.enums.TimeSlot; +import com.asap.server.service.meeting.recommend.strategy.BestMeetingTimeStrategy; +import com.asap.server.service.vo.BestMeetingTimeVo; +import java.time.LocalDate; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +class BestMeetingTimeStrategyImplTest { + private final BestMeetingTimeStrategy continuousMeetingTimeStrategy = new BestMeetingTimeStrategyImpl(); + + @DisplayName("회의 진행 시간이 30분인 경우, 3시간 이상인 블록은 긴 블록으로 처리한다.") + @Nested + class DurationHalfTest { + Duration duration = Duration.HALF; + + @DisplayName("14:00 - 16:00 returns 14:00 - 14:30") + @Test + void test() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_14_30, 0); + List expected = List.of(e1); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + + @DisplayName("14:00 - 17:00 returns 14:00 - 14:30, 16:30 - 17:00") + @Test + void test2() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_17_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_14_30, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_16_30, TimeSlot.SLOT_17_00, 0); + List expected = List.of(e1, e2); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + } + + @DisplayName("회의 진행 시간이 1시간인 경우, 4시간 이상인 블록은 긴 블록으로 처리한다.") + @Nested + class DurationHourTest { + Duration duration = Duration.HOUR; + + @DisplayName("14:00 - 16:00 returns 14:00 - 15:00") + @Test + void test() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_15_00, 0); + List expected = List.of(e1); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + + @DisplayName("14:00 - 18:00 returns 14:00 - 15:00, 17:00 - 18:00") + @Test + void test2() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_18_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_15_00, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_17_00, TimeSlot.SLOT_18_00, 0); + List expected = List.of(e1, e2); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + } + + @DisplayName("회의 진행 시간이 1시간 30분인 경우, 5시간 이상인 블록은 긴 블록으로 처리한다.") + @Nested + class DurationHourHalfTest { + Duration duration = Duration.HOUR_HALF; + + @DisplayName("14:00 - 16:00 returns 14:00 - 15:30") + @Test + void test() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_30, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_15_30, 0); + List expected = List.of(e1); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + + @DisplayName("14:00 - 19:00 returns 14:00 - 15:30, 17:30 - 19:00") + @Test + void test2() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_19_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_15_30, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_17_30, TimeSlot.SLOT_19_00, 0); + List expected = List.of(e1, e2); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + } + + @DisplayName("회의 진행 시간이 2시간인 경우, 6시간 이상인 블록은 긴 블록으로 처리한다.") + @Nested + class DurationTwoHourTest { + Duration duration = Duration.TWO_HOUR; + + @DisplayName("14:00 - 16:00 returns 14:00 - 16:00") + @Test + void test() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_00, 0); + List expected = List.of(e1); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + + + @DisplayName("14:00 - 20:00 returns 14:00 - 16:00, 18:00 - 20:00") + @Test + void test2() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_20_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_00, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_18_00, TimeSlot.SLOT_20_00, 0); + List expected = List.of(e1, e2); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + } + + @DisplayName("회의 진행 시간이 2시간 30분인 경우, 7시간 이상인 블록은 긴 블록으로 처리한다.") + @Nested + class DurationTwoHourHalfTest { + Duration duration = Duration.TWO_HOUR_HALF; + + @DisplayName("14:00 - 17:00 returns 14:00 - 16:30") + @Test + void test() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_17_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_30, 0); + List expected = List.of(e1); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + + @DisplayName("14:00 - 21:00 returns 14:00 - 16:30, 19:30 - 21:00") + @Test + void test2() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_21_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_16_30, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_18_30, TimeSlot.SLOT_21_00, 0); + List expected = List.of(e1, e2); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + } + + @DisplayName("회의 진행 시간이 3시간인 경우, 8시간 이상인 블록은 긴 블록으로 처리한다.") + @Nested + class DurationThreeHourTest { + Duration duration = Duration.THREE_HOUR; + + @DisplayName("14:00 - 17:00 returns 14:00 - 17:00") + @Test + void test() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_17_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_17_00, 0); + List expected = List.of(e1); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + + @DisplayName("14:00 - 22:00 returns 14:00 - 17:00, 19:00 - 22:00") + @Test + void test2() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_22_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_14_00, TimeSlot.SLOT_17_00, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_19_00, TimeSlot.SLOT_22_00, 0); + List expected = List.of(e1, e2); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } + } +} \ No newline at end of file From b336c4a0983ef1b17ffdc832df85b2aaadf49df8 Mon Sep 17 00:00:00 2001 From: KWY Date: Fri, 2 Aug 2024 13:53:00 +0900 Subject: [PATCH 3/5] =?UTF-8?q?#293=20[feat]=20BestMeetingTimeStrategy=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EC=B2=B4=20=EB=A1=9C=EC=A7=81=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BestMeetingTimeStrategyImpl.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java b/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java index b756880c..481fd66c 100644 --- a/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java +++ b/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java @@ -1,14 +1,42 @@ package com.asap.server.service.meeting.recommend.strategy.impl; +import com.asap.server.persistence.domain.enums.Duration; +import com.asap.server.persistence.domain.enums.TimeSlot; import com.asap.server.service.meeting.recommend.strategy.BestMeetingTimeStrategy; import com.asap.server.service.vo.BestMeetingTimeVo; +import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Component; @Component public class BestMeetingTimeStrategyImpl implements BestMeetingTimeStrategy { + private static final int EXTRA_BLOCKS = 4; + @Override - return null; public List find(List candidateMeetingTimes, Duration duration) { + List bestMeetingTimes = new ArrayList<>(); + for (BestMeetingTimeVo candidate : candidateMeetingTimes) { + bestMeetingTimes.add(createFirstTimeSlot(candidate, duration)); + + if (isTimeBlockSufficientlyLong(candidate, duration)) { + bestMeetingTimes.add(createSecondTimeSlot(candidate, duration)); + } + } + return bestMeetingTimes; + } + + private BestMeetingTimeVo createFirstTimeSlot(BestMeetingTimeVo candidate, Duration duration) { + TimeSlot endTimeSlot = TimeSlot.getTimeSlot(candidate.startTime().getIndex() + duration.getNeedBlock()); + return new BestMeetingTimeVo(candidate.date(), candidate.startTime(), endTimeSlot, candidate.weight()); + } + + private BestMeetingTimeVo createSecondTimeSlot(BestMeetingTimeVo candidate, Duration duration) { + TimeSlot startTimeSlot = TimeSlot.getTimeSlot(candidate.endTime().getIndex() - duration.getNeedBlock()); + return new BestMeetingTimeVo(candidate.date(), startTimeSlot, candidate.endTime(), candidate.weight()); + } + + private boolean isTimeBlockSufficientlyLong(BestMeetingTimeVo candidate, Duration duration) { + int timeBlockLength = candidate.endTime().getIndex() - candidate.startTime().getIndex(); + return timeBlockLength >= duration.getNeedBlock() * 2 + EXTRA_BLOCKS; } } From 2ffbf7136ed1dfed161b7386d929a4980db9a8c6 Mon Sep 17 00:00:00 2001 From: KWY Date: Fri, 2 Aug 2024 14:00:28 +0900 Subject: [PATCH 4/5] =?UTF-8?q?#293=20[test]=20=ED=9A=8C=EC=9D=98=20?= =?UTF-8?q?=EC=8B=9C=EA=B0=84=EC=9D=B4=20=EC=97=AC=EB=9F=AC=EA=B0=9C?= =?UTF-8?q?=EC=9D=BC=20=EB=95=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/BestMeetingTimeStrategyImplTest.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java b/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java index e4f8a325..f5364b8c 100644 --- a/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java +++ b/src/test/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImplTest.java @@ -58,6 +58,29 @@ void test2() { // then assertThat(response).isEqualTo(expected); } + + @DisplayName("6:00 - 6:30, 21:00 - 24:00 returns 6:00 - 6:30, 21:00 - 21:30, 23:30 - 24:00") + @Test + void test3() { + // given + LocalDate availableDate = LocalDate.of(2023, 7, 10); + BestMeetingTimeVo bestMeetingTimeVo = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_6_00, TimeSlot.SLOT_6_30, 0); + BestMeetingTimeVo bestMeetingTimeVo2 = + new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_21_00, TimeSlot.SLOT_24_00, 0); + List candidateMeetingTimes = List.of(bestMeetingTimeVo, bestMeetingTimeVo2); + + BestMeetingTimeVo e1 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_6_00, TimeSlot.SLOT_6_30, 0); + BestMeetingTimeVo e2 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_21_00, TimeSlot.SLOT_21_30, 0); + BestMeetingTimeVo e3 = new BestMeetingTimeVo(availableDate, TimeSlot.SLOT_23_30, TimeSlot.SLOT_24_00, 0); + List expected = List.of(e1, e2, e3); + + // when + List response = continuousMeetingTimeStrategy.find(candidateMeetingTimes, duration); + + // then + assertThat(response).isEqualTo(expected); + } } @DisplayName("회의 진행 시간이 1시간인 경우, 4시간 이상인 블록은 긴 블록으로 처리한다.") @@ -264,7 +287,7 @@ void test() { // then assertThat(response).isEqualTo(expected); } - + @DisplayName("14:00 - 22:00 returns 14:00 - 17:00, 19:00 - 22:00") @Test void test2() { From 12a6995d8db9ecb3774c905e325e4bc7109c567b Mon Sep 17 00:00:00 2001 From: KWY Date: Fri, 2 Aug 2024 14:02:45 +0900 Subject: [PATCH 5/5] =?UTF-8?q?#293=20[chore]=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../strategy/impl/BestMeetingTimeStrategyImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java b/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java index 481fd66c..29c73c65 100644 --- a/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java +++ b/src/main/java/com/asap/server/service/meeting/recommend/strategy/impl/BestMeetingTimeStrategyImpl.java @@ -16,21 +16,21 @@ public class BestMeetingTimeStrategyImpl implements BestMeetingTimeStrategy { public List find(List candidateMeetingTimes, Duration duration) { List bestMeetingTimes = new ArrayList<>(); for (BestMeetingTimeVo candidate : candidateMeetingTimes) { - bestMeetingTimes.add(createFirstTimeSlot(candidate, duration)); + bestMeetingTimes.add(createFirstMeetingTime(candidate, duration)); if (isTimeBlockSufficientlyLong(candidate, duration)) { - bestMeetingTimes.add(createSecondTimeSlot(candidate, duration)); + bestMeetingTimes.add(createSecondMeetingTime(candidate, duration)); } } return bestMeetingTimes; } - private BestMeetingTimeVo createFirstTimeSlot(BestMeetingTimeVo candidate, Duration duration) { + private BestMeetingTimeVo createFirstMeetingTime(BestMeetingTimeVo candidate, Duration duration) { TimeSlot endTimeSlot = TimeSlot.getTimeSlot(candidate.startTime().getIndex() + duration.getNeedBlock()); return new BestMeetingTimeVo(candidate.date(), candidate.startTime(), endTimeSlot, candidate.weight()); } - private BestMeetingTimeVo createSecondTimeSlot(BestMeetingTimeVo candidate, Duration duration) { + private BestMeetingTimeVo createSecondMeetingTime(BestMeetingTimeVo candidate, Duration duration) { TimeSlot startTimeSlot = TimeSlot.getTimeSlot(candidate.endTime().getIndex() - duration.getNeedBlock()); return new BestMeetingTimeVo(candidate.date(), startTimeSlot, candidate.endTime(), candidate.weight()); }