fix: 포인트 지급 요소 계산시 정책 시작 날짜 이후의 유저 행동들만 반영하도록 수정

This commit is contained in:
Klaus 2025-05-19 14:43:50 +09:00
parent 0f48c71837
commit fe84292483
1 changed files with 5 additions and 3 deletions

View File

@ -54,11 +54,13 @@ class UserActionService(
todayAt15 todayAt15
} }
val isValidPolicyTypeDailyAndDailyStartDateAfterPolicyStartDate =
policyType == PolicyType.DAILY && policyTypeDailyStartDate >= policy.startDate
val order = if (contentId != null) { val order = if (contentId != null) {
orderRepository.findByMemberIdAndContentId( orderRepository.findByMemberIdAndContentId(
memberId = memberId, memberId = memberId,
contentId = contentId, contentId = contentId,
createdAt = if (policyType == PolicyType.DAILY) { createdAt = if (isValidPolicyTypeDailyAndDailyStartDateAfterPolicyStartDate) {
policyTypeDailyStartDate policyTypeDailyStartDate
} else { } else {
policy.startDate policy.startDate
@ -72,7 +74,7 @@ class UserActionService(
val actionCount = repository.countByMemberIdAndActionTypeAndCreatedAtBetween( val actionCount = repository.countByMemberIdAndActionTypeAndCreatedAtBetween(
memberId = memberId, memberId = memberId,
actionType = actionType, actionType = actionType,
startDate = if (policyType == PolicyType.DAILY) { startDate = if (isValidPolicyTypeDailyAndDailyStartDateAfterPolicyStartDate) {
policyTypeDailyStartDate policyTypeDailyStartDate
} else { } else {
policy.startDate policy.startDate
@ -84,7 +86,7 @@ class UserActionService(
val grantedCount = grantLogRepository.countByMemberIdAndPolicyIdAndStartDate( val grantedCount = grantLogRepository.countByMemberIdAndPolicyIdAndStartDate(
memberId, memberId,
policy.id!!, policy.id!!,
startDate = if (policyType == PolicyType.DAILY) { startDate = if (isValidPolicyTypeDailyAndDailyStartDateAfterPolicyStartDate) {
policyTypeDailyStartDate policyTypeDailyStartDate
} else { } else {
policy.startDate policy.startDate