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()); } } 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