diff --git a/domain/daily/src/main/kotlin/com/titi/app/doamin/daily/usecase/GetResetDailyEventUseCase.kt b/domain/daily/src/main/kotlin/com/titi/app/doamin/daily/usecase/GetResetDailyEventUseCase.kt index d67888dd..63fd00ec 100644 --- a/domain/daily/src/main/kotlin/com/titi/app/doamin/daily/usecase/GetResetDailyEventUseCase.kt +++ b/domain/daily/src/main/kotlin/com/titi/app/doamin/daily/usecase/GetResetDailyEventUseCase.kt @@ -8,19 +8,23 @@ class GetResetDailyEventUseCase @Inject constructor( private val dailyRepository: DailyRepository, ) { suspend operator fun invoke(): Boolean { - val resetDaily = dailyRepository.getResetDailyEvent() - val today = getDailyDayWithHour(6).first + val resetEventDate = dailyRepository.getResetDailyEvent() + val (todayDate, endOfToday) = getDailyDayWithHour(6) - return if (resetDaily != null) { - if (resetDaily != today) { - dailyRepository.setResetDailyEvent(today) + return if (resetEventDate != null) { + if (resetEventDate != todayDate) { + dailyRepository.setResetDailyEvent(todayDate) true } else { false } } else { - dailyRepository.setResetDailyEvent(today) - true + dailyRepository.setResetDailyEvent(todayDate) + val dailyEvent = dailyRepository.getDateDaily( + startDateTime = todayDate, + endDateTime = endOfToday, + ) + dailyEvent == null } } }