From 6983ef0a3658adce0bcb34fe03282f819cc8306c Mon Sep 17 00:00:00 2001 From: nnijgnus Date: Fri, 23 Aug 2024 18:30:01 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20conflict=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/eventService/RushEventService.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java index e2986f11..5f6d9416 100644 --- a/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java +++ b/Server/src/main/java/JGS/CasperEvent/domain/event/service/eventService/RushEventService.java @@ -94,17 +94,13 @@ public void apply(BaseUser user, int optionId) { // 진행중인 게임의 응모 비율 반환 public RushEventResultResponseDto getRushEventRate(BaseUser user) { LocalDate today = LocalDate.now(); - - Long todayEventId = eventCacheService.getTodayEvent(today).rushEventId(); - - // 해당 유저의 optionId 를 가져옴 - int optionId = eventCacheService.getOptionId(today, user.getPhoneNumber()); + Long todayEventId = eventCacheService.getTodayEvent(today).getRushEventId(); + Optional optionId = rushParticipantsRepository.getOptionIdByUserId(user.getPhoneNumber()); long leftOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 1); long rightOptionCount = rushParticipantsRepository.countByRushEvent_RushEventIdAndOptionId(todayEventId, 2); - return new RushEventRateResponseDto( - optionId, + return RushEventResultResponseDto.of(optionId.orElseThrow(() -> new CustomException("유저가 응모한 선택지가 존재하지 않습니다.", CustomErrorCode.USER_NOT_FOUND)), leftOptionCount, rightOptionCount); } @@ -233,11 +229,8 @@ public void setRushEvents() { rushEvents.add(rushEvent); } - LocalDate today = LocalDate.now(); - - eventCacheService.setCacheValue(today); + eventCacheService.setCacheValue(LocalDate.now()); eventCacheService.setAllRushEvent(); - eventCacheService.clearUserOptionCache(); rushEventRedisService.clearAllrushEventRate(); }