Skip to content

Commit

Permalink
fix: 세미나 출석 전 -> 결석 처리 메서드 쿼리 수정 및 @transactional 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
shkisme committed Oct 13, 2023
1 parent cb146a2 commit ccce1e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public void changeStatus(long attendanceId, SeminarAttendanceStatusType statusTy
seminarAttendance.removeExcuse();
}

@Scheduled(cron = "0 0 0 * * ?", zone = "Asia/Seoul") // 매일 자정에 실행
@Scheduled(cron = "0 50 23 * * ?", zone = "Asia/Seoul") // 매일 23시 50분에 실행
@Transactional
public void changeAllBeforeAttendanceToAbsence() {
attendanceRepository.updateAllBeforeAttendanceToAbsence();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public interface SeminarAttendanceRepository extends JpaRepository<SeminarAttend
@Modifying
@Query("UPDATE SeminarAttendance s "
+ "SET s.seminarAttendanceStatus.id = 3 " // 결석
+ "WHERE s.seminarAttendanceStatus.id = 5") // 출석 전
+ "WHERE s.seminarAttendanceStatus.id = 5 " // 출석 전
+ "AND DATE(s.attendTime) = current date")
void updateAllBeforeAttendanceToAbsence();

@Query("SELECT s FROM SeminarAttendance s "
Expand Down

0 comments on commit ccce1e8

Please sign in to comment.