From 20ffdf5e1ec7c2b8dac17cdd2adecabfbbe51d3d Mon Sep 17 00:00:00 2001 From: EunbeenDev Date: Thu, 6 Feb 2025 21:44:50 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20=EB=89=B4=EC=8A=A4=20=EC=8A=A4=ED=83=AC?= =?UTF-8?q?=ED=94=84=20=ED=98=84=ED=99=A9=20=EA=B4=80=EB=A0=A8=20=EB=AA=85?= =?UTF-8?q?=EC=84=B8=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존: 5개 다 채워진 후에 다음 날 0개로 초기화 변경 후: 5개 모두 채워진 후에 다음 뉴스 생성 시 1개로 시작 --- .../domain/news/application/NewsService.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/movelog/domain/news/application/NewsService.java b/src/main/java/com/movelog/domain/news/application/NewsService.java index d998fbf..6a5d1d7 100644 --- a/src/main/java/com/movelog/domain/news/application/NewsService.java +++ b/src/main/java/com/movelog/domain/news/application/NewsService.java @@ -119,25 +119,10 @@ public TodayNewsStatusRes getTodayNewsStatus(UserPrincipal userPrincipal) { .mapToLong(newsRepository::countByKeyword) .sum(); - long newsStatus = totalNewsCount % 5; - LocalDateTime today = LocalDateTime.now(); - - // 오늘 생성한 뉴스가 있으면 true, 없으면 false - boolean isTodayNews = !newsRepository.findRecentNewsByUser(user, today, PageRequest.of(0, 1)).isEmpty(); - - int result; - if(newsStatus == 0 && isTodayNews) { - result = 5; - } - else if(newsStatus == 0) { - result = 0; - } - else { - result = (int) newsStatus; - } + long newsStatus = totalNewsCount % 6; return TodayNewsStatusRes.builder() - .newsStatus(result) + .newsStatus((int) newsStatus) .build(); }