2828@ RequiredArgsConstructor
2929public class HomeFeedFacadeService {
3030
31- private static final LocalDate today = LocalDate .now ();
32- private static final LocalDate monday = today .with (DayOfWeek .MONDAY );
33- private static final LocalDate friday = today .with (DayOfWeek .FRIDAY );
3431 private final ProblemSetStatisticRepository problemSetStatisticRepository ;
3532 private final PublishGetService publishGetService ;
3633 private final ProblemSetGetService problemSetGetService ;
3734 private final ProblemSubmitGetService problemSubmitGetService ;
3835
3936 @ Transactional (readOnly = true )
4037 public HomeFeedResponse getHomeFeed (Member member ) {
38+ LocalDate today = LocalDate .now ();
39+ LocalDate monday = today .with (DayOfWeek .MONDAY );
40+ LocalDate friday = today .with (DayOfWeek .FRIDAY );
41+
4142 Long memberId = member .getId ();
4243
4344 List <Publish > publishes = publishGetService .getPublishesBetweenDates (monday , friday );
4445
45- List <DailyProgressResponse > dailyProgresses = getDailyProgresses (memberId , publishes );
46+ List <DailyProgressResponse > dailyProgresses = getDailyProgresses (memberId , publishes , monday , friday );
4647
47- List <ProblemSetHomeFeedResponse > problemSets = getWeekdayProblemSets (publishes );
48+ List <ProblemSetHomeFeedResponse > problemSets = getWeekdayProblemSets (publishes , monday , friday );
4849
4950 return HomeFeedResponse .of (dailyProgresses , problemSets );
5051 }
5152
52- private List <DailyProgressResponse > getDailyProgresses (Long memberId , List <Publish > publishes ) {
53+ private List <DailyProgressResponse > getDailyProgresses (Long memberId , List <Publish > publishes ,
54+ LocalDate monday , LocalDate friday ) {
5355
5456 Map <LocalDate , ProgressStatus > progressStatuses = problemSubmitGetService .getProgressStatuses (memberId ,
5557 publishes );
@@ -66,7 +68,8 @@ private List<DailyProgressResponse> getDailyProgresses(Long memberId, List<Publi
6668 return responses ;
6769 }
6870
69- private List <ProblemSetHomeFeedResponse > getWeekdayProblemSets (List <Publish > publishes ) {
71+ private List <ProblemSetHomeFeedResponse > getWeekdayProblemSets (List <Publish > publishes ,
72+ LocalDate monday , LocalDate friday ) {
7073
7174 Map <LocalDate , Publish > publishByDate = publishes .stream ()
7275 .collect (Collectors .toMap (Publish ::getPublishedDate , publish -> publish ));
0 commit comments