Skip to content

Commit

Permalink
Code migration
Browse files Browse the repository at this point in the history
  • Loading branch information
rudeh2926 committed Nov 12, 2024
1 parent 73fa7d4 commit fa893fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@ class QueryFloorApplicationService(

@Transactional(readOnly = true)
override fun queryFloorAndStatusApplication(floor: Int, status: Status): List<QueryApplicationResponse> {
val today = LocalDate.now().dayOfWeek

val applications = when (floor) {
2, 3, 4 -> {
val filteredClassrooms = if (today == 2 || today == 5) {
queryApplicationPort.queryApplicationWithAttendance(floor)
} else {
val filterClassroomList =
queryApplicationPort.findByFloorAndApplicationKind(floor, ApplicationKind.APPLICATION)
}
filteredClassrooms.filter { it.status == status }
filterClassroomList.filter { it.status == status }
}
5 -> {
queryAllApplicationPort.findAllByStatusAndApplicationKind(status, ApplicationKind.APPLICATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ class AttendancePersistenceAdapter(

override fun findAll() = attendanceJpaRepository.findAll().map { attendanceMapper.toDomain(it) }

override fun findByFloor(floor: Int): List<Attendance>? = attendanceJpaRepository.findByFloor(floor).map {
attendanceMapper.toDomain(
it
)
}
override fun findByFloor(floor: Int): List<Attendance>? =
jpaQueryFactory
.selectFrom(QAttendanceJpaEntity.attendanceJpaEntity)
.where(
QAttendanceJpaEntity.attendanceJpaEntity.floor.eq(floor),
QAttendanceJpaEntity.attendanceJpaEntity.period6.ne(AttendanceStatus.DROPOUT)
)
.fetch()
.map { attendanceMapper.toDomain(it) }

override fun findByGradeAndClassNum(
grade: Int,
Expand All @@ -41,7 +45,8 @@ class AttendancePersistenceAdapter(
.selectFrom(QAttendanceJpaEntity.attendanceJpaEntity)
.where(
QAttendanceJpaEntity.attendanceJpaEntity.grade.eq(grade),
QAttendanceJpaEntity.attendanceJpaEntity.classNum.eq(classNum)
QAttendanceJpaEntity.attendanceJpaEntity.classNum.eq(classNum),
QAttendanceJpaEntity.attendanceJpaEntity.period6.ne(AttendanceStatus.DROPOUT)
)
.fetch()
.map { attendanceMapper.toDomain(it) }
Expand Down

0 comments on commit fa893fa

Please sign in to comment.