-
Notifications
You must be signed in to change notification settings - Fork 2
[BE] SISC1-223 [FIX] 출석 세션 시간 변수 수정 #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "SISC1-223-BE-\uCD9C\uC11D-\uC138\uC158-\uC2DC\uAC04-\uBCC0\uC218-\uC218\uC815"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| package org.sejongisc.backend.attendance.dto; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.*; | ||
| import lombok.*; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.time.LocalTime; | ||
|
|
||
| @Getter | ||
| @Builder | ||
|
|
@@ -19,33 +20,34 @@ public class AttendanceSessionRequest { | |
|
|
||
| @Schema( | ||
| description = "세션의 제목/이름", | ||
| example = "2024년 10월 동아리 정기 모임", | ||
| example = "금융 IT팀 세션", | ||
| maxLength = 100 | ||
| ) | ||
| @NotBlank(message = "제목은 필수입니다") | ||
| @Size(max = 100, message = "제목은 100자 이하여야 합니다") | ||
| private String title; | ||
|
|
||
| @Schema( | ||
| description = "세션 시작 시간 (ISO 8601 형식). 현재 시간 이후여야 합니다.", | ||
| example = "2024-11-15T14:00:00", | ||
| description = "세션의 기본 시작 시간 (HH:MM:SS 형식). " + | ||
| "모든 라운드는 이 시간을 기본값으로 사용합니다.", | ||
| example = "18:30:00", | ||
| type = "string", | ||
| format = "date-time" | ||
| format = "time" | ||
| ) | ||
| @NotNull(message = "시작 시간은 필수입니다") | ||
| @Future(message = "시작 시간은 현재 시간 이후여야 합니다") | ||
| private LocalDateTime startsAt; | ||
| @JsonFormat(pattern = "HH:mm:ss") | ||
| private LocalTime defaultStartTime; | ||
|
|
||
| @Schema( | ||
| description = "출석 체크인이 가능한 시간 윈도우 (초 단위). " + | ||
| "범위: 300초(5분) ~ 14400초(4시간)", | ||
| example = "1800", | ||
| minimum = "300", | ||
| maximum = "14400" | ||
| description = "출석 인정 시간 (분 단위). " + | ||
| "범위: 1분 ~ 240분(4시간)", | ||
| example = "30", | ||
| minimum = "1", | ||
| maximum = "240" | ||
| ) | ||
| @Min(value = 300, message = "최소 5분 이상이어야 합니다") | ||
| @Max(value = 14400, message = "최대 4시간 설정 가능합니다") | ||
| private Integer windowSeconds; | ||
| @Min(value = 1, message = "최소 1분 이상이어야 합니다") | ||
| @Max(value = 240, message = "최대 240분(4시간) 설정 가능합니다") | ||
| private Integer defaultAvailableMinutes; | ||
|
Comment on lines
41
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain최소 시간 제한 변경 검증 필요 출석 인정 시간의 단위가 초에서 분으로 변경되면서, 최소값이 300초(5분)에서 1분으로 감소했습니다:
1분의 출석 인정 시간은 다음과 같은 문제를 야기할 수 있습니다:
최소 5분 정책이 비즈니스 요구사항이었다면, 비즈니스 로직 검증을 위해 다음을 확인해주세요: 🏁 Script executed: #!/bin/bash
# 기존 windowSeconds 사용처에서 최소값 검증 로직 확인
rg -n -C3 --type=java "windowSeconds|availableMinutes" | rg -C3 "300|5.*minute"
# 테스트 코드에서 최소값 테스트 케이스 확인
rg -n --type=java "availableMinutes.*[1-5]" backend/src/test/Length of output: 2041 Need to check if there are references to the old 5-minute constraint in the actual business logic. Based on my verification, I need to gather more direct information from the codebase to understand if this change was intentional. Length of output: 1679 Let me search with the correct directory structure: 🏁 Script executed: #!/bin/bash
# Search for availableMinutes usage in service/controller/dto
rg -n -B3 -A3 "availableMinutes" git/backend/src/main/java/org/sejongisc/backend/attendance/ --type=java
# Look for any business logic with duration/time calculations
rg -n -B2 -A2 "availableMinutes|windowSeconds" git/backend/src/main/java/org/sejongisc/backend/attendance/service/ --type=javaLength of output: 207 Let me try a different approach to inspect the files directly: 🏁 Script executed: #!/bin/bash
# Find and display the AttendanceRoundRequest.java file
find . -name "AttendanceRoundRequest.java" -type f
# Find and display the AttendanceRoundService.java file
find . -name "AttendanceRoundService.java" -type f
# Find dto files related to attendance
find . -path "*/attendance/dto/*" -name "*.java" -type fLength of output: 990 |
||
|
|
||
| @Schema( | ||
| description = "출석 완료 시 지급할 포인트", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,15 +64,21 @@ public class Attendance extends BasePostgresEntity { | |
| // 지각 여부 계산 / 상태 업데이트 | ||
|
|
||
| /** | ||
| /** | ||
| * 지각 여부 판단 | ||
| * - 라운드의 시작 시간 이후에 체크인했으면 지각 | ||
| */ | ||
| public boolean isLate() { | ||
| if (checkedAt == null || attendanceSession.getStartsAt() == null) { | ||
| if (checkedAt == null || attendanceRound == null) { | ||
| return false; | ||
| } | ||
| return checkedAt.isAfter(attendanceSession.getStartsAt()); | ||
| // 라운드의 시작 시간(LocalTime)과 체크인 시간(LocalDateTime)을 비교 | ||
| LocalDateTime roundStartDateTime = attendanceRound.getRoundDate() | ||
| .atTime(attendanceRound.getStartTime()); | ||
| return checkedAt.isAfter(roundStartDateTime); | ||
| } | ||
|
Comment on lines
+67
to
79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain
현재 구현은 체크인 시간이 라운드 시작 시간 이후면 지각으로 판단합니다. 그러나 일반적으로 "지각"은 출석 인정 시간(availableMinutes) 이후에 체크인한 경우를 의미합니다. 예: 시작 시간 18:30, 출석 인정 30분이면 18:30~19:00 사이는 정상 출석, 19:00 이후가 지각이어야 합니다. public boolean isLate() {
if (checkedAt == null || attendanceRound == null) {
return false;
}
- // 라운드의 시작 시간(LocalTime)과 체크인 시간(LocalDateTime)을 비교
LocalDateTime roundStartDateTime = attendanceRound.getRoundDate()
.atTime(attendanceRound.getStartTime());
- return checkedAt.isAfter(roundStartDateTime);
+ // 출석 인정 시간 이후에 체크인했으면 지각
+ LocalDateTime lateThreshold = roundStartDateTime
+ .plusMinutes(attendanceRound.getAvailableMinutes());
+ return checkedAt.isAfter(lateThreshold);
}🏁 Script executed: #!/bin/bash
# Description: AttendanceRound 엔티티에서 availableMinutes 필드와 getter 확인
# availableMinutes 필드 확인
ast-grep --pattern $'class AttendanceRound {
$$$
availableMinutes
$$$
}'
# getAvailableMinutes 메서드 또는 필드 검색
rg -n "availableMinutes" --type javaLength of output: 2812 🏁 Script executed: #!/bin/bash
# Find and examine the AttendanceRound entity class definition
# Look for the AttendanceRound entity class
fd -t f "AttendanceRound.java" --exclude="*Test*" --exclude="*Request*" --exclude="*Response*"
# Search for the entity file path
rg -n "class AttendanceRound" --type java -A 30 --exclude="*Test*" --exclude="*Request*" --exclude="*Response*" | head -100Length of output: 494 🏁 Script executed: #!/bin/bash
# Get content of AttendanceRound entity to see all methods
cat backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceRound.javaLength of output: 3429
현재 구현은 체크인 시간이 라운드 시작 시간 이후면 지각으로 판단합니다. 일반적으로 "지각"은 출석 인정 시간( 예: 시작 시간 18:30, 출석 인정 30분이면 18:30~19:00 사이는 정상 출석, 19:00 이후가 지각입니다. 단, 제안된 수정에서 사용된 public boolean isLate() {
if (checkedAt == null || attendanceRound == null) {
return false;
}
- // 라운드의 시작 시간(LocalTime)과 체크인 시간(LocalDateTime)을 비교
LocalDateTime roundStartDateTime = attendanceRound.getRoundDate()
.atTime(attendanceRound.getStartTime());
- return checkedAt.isAfter(roundStartDateTime);
+ // 출석 인정 시간 이후에 체크인했으면 지각
+ LocalDateTime lateThreshold = roundStartDateTime
+ .plusMinutes(attendanceRound.getAllowedMinutes());
+ return checkedAt.isAfter(lateThreshold);
}
|
||
|
|
||
|
|
||
| /** | ||
| * 상태 업데이트 (관리자용) | ||
| */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,14 @@ | ||
| package org.sejongisc.backend.attendance.repository; | ||
|
|
||
| import org.sejongisc.backend.attendance.entity.AttendanceSession; | ||
| import org.sejongisc.backend.attendance.entity.SessionStatus; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
|
|
||
| @Repository | ||
| public interface AttendanceSessionRepository extends JpaRepository<AttendanceSession, UUID> { | ||
|
|
||
| // 출석 코드로 세션 찾기 (학생 출석 체크) | ||
| Optional<AttendanceSession> findByCode(String code); | ||
|
|
||
| // 상태별 세션 조회 | ||
| List<AttendanceSession> findByStatus(SessionStatus status); | ||
|
|
||
| // 모든 세션을 최신순으로 조회 (관리자용) | ||
| List<AttendanceSession> findAllByOrderByStartsAtDesc(); | ||
|
|
||
| // 코드 중복 체크 | ||
| boolean existsByCode(String code); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
@Future검증 제거 및 날짜 정보 손실 확인 필요LocalDateTime startsAt에서LocalTime defaultStartTime으로 변경하면서 다음 사항들을 확인해주세요:검증 로직 손실: 기존
@Future어노테이션이 제거되어 과거 시간에 대한 검증이 불가능합니다. 날짜 정보 없이 시간만으로는 미래 여부를 판단할 수 없으므로, 서비스 레이어에서 날짜와 함께 검증하는 로직이 추가되었는지 확인이 필요합니다.의미론적 변경: 절대 날짜시간에서 시간대(time-of-day)로의 변경은 세션이 "언제" 시작하는지가 아닌 "몇 시에" 시작하는지만 나타냅니다. 이것이 의도된 설계 변경인지 확인해주세요.
데이터베이스 마이그레이션: 기존
LocalDateTime데이터가LocalTime으로 올바르게 마이그레이션되었는지 확인이 필요합니다.다음 스크립트로 관련 엔티티와 서비스 레이어의 검증 로직을 확인해주세요:
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 11423
🏁 Script executed:
Length of output: 7586
제거된
@Future검증 대체 로직 미발견검증 결과 다음 사항이 확인되었습니다:
검증 손실 확인:
AttendanceSession엔티티(line 32)와AttendanceSessionRequestDTO(line 39) 모두에서@Future검증이 제거되었으며, 서비스 레이어에서도 대체 검증 로직이 없습니다.시간만 저장:
LocalTime사용으로 인해 시간대(time-of-day)만 저장되고 날짜 정보가 제거되었습니다. 엔티티 주석도 "시간만"이라고 명시합니다.검증 공백: 현재는
@NotNull만 있어서 null 값만 방지하고, 과거 시간 설정을 막을 방법이 없습니다. 다른 레이어에서도defaultStartTime에 대한 시간 유효성 검증이 발견되지 않습니다.데이터베이스: 마이그레이션 파일이 없어서 기존
LocalDateTime데이터의 마이그레이션 상태를 확인할 수 없습니다.필수 검토 항목:
defaultStartTime이 유효한(미래의) 시간인지 검증하는 로직 추가 필요🤖 Prompt for AI Agents