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

[feat] 디데이 계산 로직 수정, 유저의 소원권 조회에서 빈 콘텐츠 제외하기 #101

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions src/main/java/com/universe/uni/service/HomeService.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.universe.uni.service;

import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;

import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -73,9 +74,9 @@ private int calculateScore(List<UserGameHistory> gameHistoryList, GameResult res
}

private int calculateDays(Couple couple) {
LocalDate today = LocalDate.now();
Period period = Period.between(couple.getStartDate(), today);
return period.getDays() + 1;
ZonedDateTime localTime = ZonedDateTime.now(ZoneId.of("Asia/Seoul"));
long dDay = ChronoUnit.DAYS.between(couple.getStartDate(), localTime.toLocalDate());
return (int)dDay + 1;
}

private CoupleDto fromCoupleToCoupleDtoMapper(Couple couple) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/universe/uni/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public UserWishCouponResponseDto getUserWishCouponList(Long userId) {
.stream()
.flatMap(entry -> entry.getValue().stream())
.map(this::fromWishCouponToWishCouponDto)
.filter(wishCouponDto -> !wishCouponDto.content().isBlank())
.collect(Collectors.toList());

return UserWishCouponResponseDto.builder()
Expand Down
Loading