From ef9f2b0999f5b83ca64ef3d03552c80c220f6f69 Mon Sep 17 00:00:00 2001 From: its-sky Date: Mon, 8 Apr 2024 21:42:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Fix]=20#261=20-=20History=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/moonshot/objective/service/ObjectiveService.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java b/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java index 4fd97249..ba304d2b 100644 --- a/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java +++ b/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java @@ -14,7 +14,6 @@ import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.moonshot.common.model.Period; @@ -120,11 +119,6 @@ public HistoryResponseDto getObjectiveHistory(final Long userId, final Integer y List objectives = objectiveRepository.findObjectives(userId, year, category, criteria); Map> groups = objectives.stream() .collect(Collectors.groupingBy(objective -> objective.getPeriod().getStartAt().getYear())); - Map years = groups.entrySet().stream() - .collect(Collectors.toMap( - Entry::getKey, - entry -> entry.getValue().size() - )); List categories = objectives.stream().map(objective -> objective.getCategory().getValue()).toList(); List groupList = groups.entrySet().stream() @@ -142,7 +136,7 @@ public HistoryResponseDto getObjectiveHistory(final Long userId, final Integer y .sorted(Comparator.comparingInt(ObjectiveGroupByYearDto::year).reversed()).toList(); } - return HistoryResponseDto.of(groupsSortedByCriteria, years, categories, criteria); + return HistoryResponseDto.of(groupsSortedByCriteria, categories); } @Override From 469a9697702b6b868e1a575025104aa3d097417b Mon Sep 17 00:00:00 2001 From: its-sky Date: Mon, 8 Apr 2024 21:42:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Fix]=20#261=20-=20History=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20DTO=20=EC=8A=A4=ED=8E=99=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../objective/dto/response/HistoryResponseDto.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/moonshot-api/src/main/java/org/moonshot/objective/dto/response/HistoryResponseDto.java b/moonshot-api/src/main/java/org/moonshot/objective/dto/response/HistoryResponseDto.java index fb94fbdc..b064f89b 100644 --- a/moonshot-api/src/main/java/org/moonshot/objective/dto/response/HistoryResponseDto.java +++ b/moonshot-api/src/main/java/org/moonshot/objective/dto/response/HistoryResponseDto.java @@ -1,20 +1,12 @@ package org.moonshot.objective.dto.response; import java.util.List; -import java.util.Map; -import org.moonshot.objective.model.Criteria; public record HistoryResponseDto( List groups, - List years, List categories ) { - public static HistoryResponseDto of(List groups, Map years, - List categories, Criteria criteria) { - return new HistoryResponseDto( - groups, - YearDto.of(years), - categories.stream().distinct().toList() - ); + public static HistoryResponseDto of(List groups, List categories) { + return new HistoryResponseDto(groups, categories.stream().distinct().toList()); } }