Skip to content

Commit

Permalink
Merge pull request #474 from team-yello/develop
Browse files Browse the repository at this point in the history
develop [develop] (fix) 날짜별 기준 이벤트 참여이력 조회 로직 추가
  • Loading branch information
euije authored Mar 5, 2024
2 parents a489c61 + 9af8a39 commit 8019598
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public class EventService {

private final EventRepository eventRepository;
private final ObjectMapper objectMapper;
private final UserRepository userRepository;
private final UserDataRepository userDataRepository;
private final UserRepository userRepository;

public List<EventResponse> getEvents(Long userId) throws JsonProcessingException {
// exception
Expand Down Expand Up @@ -99,17 +99,18 @@ public List<EventResponse> getEvents(Long userId) throws JsonProcessingException
if (!eventTimeList.isEmpty()) {
final EventTime eventTime = eventTimeList.get(0);

// 현재 시각이 이벤트 시간에 유효하고, 남은 보상 카운트가 0인 이력
// 현재 시각이 이벤트 시간에 유효하고, 날짜별 기준, 남은 보상 카운트가 0인 이력
eventInstanceList.addAll(
eventRepository.findInstanceAllByEventTimeAndUser(
eventTime, user)
.stream()
.filter(eventInstance ->
eventInstance.getInstanceDate().isAfter(event.getStartDate())
&& eventInstance.getInstanceDate().isBefore(event.getEndDate())
&& eventInstance.getInstanceDate().toLocalDate().isEqual(now.toLocalDate())
&& nowTime.isAfter(eventInstance.getEventTime().getStartTime())
&& nowTime.isBefore(eventInstance.getEventTime().getEndTime())
&& eventInstance.getRemainEventCount()==0
&& eventInstance.getRemainEventCount() == 0
)
.toList()
);
Expand Down Expand Up @@ -278,7 +279,7 @@ public EventRewardResponse rewardAdmob(Long userId, AdmobRewardRequest request)
}

// history 있으면 userId로 세팅
if (eventHistory.get().getUser()!=null) {
if (eventHistory.get().getUser() != null) {
throw new EventForbiddenException(DUPLICATE_ADMOB_REWARD_EXCEPTION);
}
eventHistory.get().update(user);
Expand Down

0 comments on commit 8019598

Please sign in to comment.