Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rudeh2926 committed Oct 31, 2024
2 parents a766b79 + f77cbc4 commit c85b354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.time.LocalDate
import java.time.LocalDate.now
import java.time.ZoneId

@Service
class QueryIsWeekendMealPeriodService(
Expand All @@ -16,7 +17,7 @@ class QueryIsWeekendMealPeriodService(

@Transactional(readOnly = true)
override fun isWeekendMealPeriod(): QueryIsPeriodStatusResponse {
val today = now()
val today = now(ZoneId.of("Asia/Seoul"))
val periods = queryWeekendMealPeriodPort.queryAllWeekendMeal()

val currentPeriod = findCurrentPeriod(today, periods)
Expand All @@ -32,7 +33,7 @@ class QueryIsWeekendMealPeriodService(

private fun findCurrentPeriod(today: LocalDate, periods: List<WeekendMealPeriod>): WeekendMealPeriod? {
return periods.find {
today.isAfter(it.start.minusDays(1)) && today.isBefore(it.end.plusDays(1))
(today.isEqual(it.start) || today.isAfter(it.start)) && today.isBefore(it.end.plusDays(1))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import dsm.pick2024.domain.weekendmeal.presentation.dto.response.QueryWeekendMea
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.time.LocalDate.*
import java.time.ZoneId

@Service
class QueryWeekendMealApplicationService(
Expand All @@ -14,12 +15,12 @@ class QueryWeekendMealApplicationService(

@Transactional
override fun queryWeekendMealApplication(): QueryWeekendMealStatusResponse {
val today = now()
val today = now(ZoneId.of("Asia/Seoul"))

val periods = queryWeekendMealPeriodPort.queryAllWeekendMeal()

val period = periods.find {
today.isAfter(it.start.minusDays(1)) && today.isBefore(it.end.plusDays(1))
(today.isEqual(it.start) || today.isAfter(it.start)) && today.isBefore(it.end.plusDays(1))
}

val status = period != null
Expand Down

0 comments on commit c85b354

Please sign in to comment.