Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hotfix] (fix) 날짜별 기준 이벤트 참여이력 조회 로직 추가 #475

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading