From dbf89da6eb67944c65c1403ae1d9979984fa924c Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Mon, 2 Dec 2024 00:13:17 +0900 Subject: [PATCH] =?UTF-8?q?#123=20[fix]=20:=20=EA=B0=80=EC=9E=A5=20?= =?UTF-8?q?=EB=A7=8E=EC=9D=B4=20=EB=90=98=EB=8A=94=20=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EB=AC=B8=EC=A0=9C=EB=A5=BC=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/side/onetime/service/EventService.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/side/onetime/service/EventService.java b/src/main/java/side/onetime/service/EventService.java index cdbc667..639c4c0 100644 --- a/src/main/java/side/onetime/service/EventService.java +++ b/src/main/java/side/onetime/service/EventService.java @@ -229,17 +229,22 @@ private List buildMostPossibleTimes(Map mostPossibleTimes = new ArrayList<>(); GetMostPossibleTime previousTime = null; + boolean stopFlag = false; for (Map.Entry> entry : scheduleToNamesMap.entrySet()) { Schedule schedule = entry.getKey(); List curNames = entry.getValue(); if (curNames.size() == mostPossibleCnt) { - // 이전 시간대와 병합 가능한 경우 if (canMergeWithPrevious(previousTime, schedule, curNames, category)) { - // 종료 시간을 더해 업데이트 + // 이전 시간대와 병합 가능한 경우 previousTime = previousTime.updateEndTime(schedule.getTime()); - mostPossibleTimes.set(mostPossibleTimes.size() - 1, previousTime); + mostPossibleTimes.set(mostPossibleTimes.size() - 1, previousTime); // 종료 시간을 더해 업데이트 } else { + // 새로운 시간대를 추가하는 경우 + if (mostPossibleTimes.size() == MAX_MOST_POSSIBLE_TIMES_SIZE) { + // 6개를 찾았을 시 종료 + stopFlag = true; + } List impossibleNames = allMembersName.stream() .filter(name -> !curNames.contains(name)) .toList(); @@ -250,8 +255,7 @@ private List buildMostPossibleTimes(Map