diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/spi/QueryStatusSpi.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/spi/QueryStatusSpi.kt index 9fe40e68..bffc3054 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/spi/QueryStatusSpi.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/spi/QueryStatusSpi.kt @@ -25,7 +25,7 @@ interface QueryStatusSpi { fun queryMovementStudentStatusIdByStudentIdAndToday(studentId: UUID): UUID? - fun queryStatusTypesByStudentIdAndEndPeriod(studentId: UUID, period: Int): List + fun queryStatusTypesByStudentIdAndEndPeriodAndToday(studentId: UUID, period: Int): List fun queryMovementStatusListByTodayAndClassroomId(classroomId: UUID): List diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/classroom/usecase/ClassroomMovementUseCase.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/classroom/usecase/ClassroomMovementUseCase.kt index 0264e135..e247a4af 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/classroom/usecase/ClassroomMovementUseCase.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/classroom/usecase/ClassroomMovementUseCase.kt @@ -66,7 +66,7 @@ class ClassroomMovementUseCase( val time = timeList.timeList.find { time -> time.period == request.period } ?: throw TimeNotFoundException - val statusTypes = queryStatusSpi.queryStatusTypesByStudentIdAndEndPeriod( + val statusTypes = queryStatusSpi.queryStatusTypesByStudentIdAndEndPeriodAndToday( studentId = student.id, period = request.period, ) diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt index f557a239..283b09f8 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/persistence/adapter/StatusPersistenceAdapter.kt @@ -148,13 +148,14 @@ class StatusPersistenceAdapter( ) .fetchOne() - override fun queryStatusTypesByStudentIdAndEndPeriod(studentId: UUID, period: Int): List = + override fun queryStatusTypesByStudentIdAndEndPeriodAndToday(studentId: UUID, period: Int): List = jpaQueryFactory .select(statusEntity.type) .from(statusEntity) .where( statusEntity.studentId.eq(studentId), statusEntity.endPeriod.lt(period), // 상태의 endPeriod < period면 + statusEntity.date.eq(LocalDate.now()) ) .fetch()