Skip to content

Revert "[BE] SISC1-224 [FIX] 출석 라운드 관련 수정"#144

Merged
Kosw6 merged 1 commit intomainfrom
revert-143-SISC1-224-BE-출석-라운드-관련-수정
Nov 26, 2025

Hidden character warning

The head ref may contain hidden characters: "revert-143-SISC1-224-BE-\ucd9c\uc11d-\ub77c\uc6b4\ub4dc-\uad00\ub828-\uc218\uc815"
Merged

Revert "[BE] SISC1-224 [FIX] 출석 라운드 관련 수정"#144
Kosw6 merged 1 commit intomainfrom
revert-143-SISC1-224-BE-출석-라운드-관련-수정

Conversation

@Kosw6
Copy link
Collaborator

@Kosw6 Kosw6 commented Nov 26, 2025

Reverts #143

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 학생을 위한 새로운 출석 체크인 API 엔드포인트 추가
  • 개선 사항

    • 세션 시간 및 체크인 기간 관리 체계 개선
    • 지각 판정 로직 단순화
    • API 응답 필드 명칭 표준화
  • 테스트

    • API 변경사항에 따른 테스트 업데이트

✏️ Tip: You can customize this high-level summary in your review settings.

@Kosw6 Kosw6 requested a review from discipline24 as a code owner November 26, 2025 04:43
@Kosw6 Kosw6 merged commit 4ed85e8 into main Nov 26, 2025
1 check was pending
@Kosw6 Kosw6 deleted the revert-143-SISC1-224-BE-출석-라운드-관련-수정 branch November 26, 2025 04:43
@coderabbitai
Copy link

coderabbitai bot commented Nov 26, 2025

Caution

Review failed

The pull request is closed.

수행 방식

학생 체크인 기능을 추가하고 출석 세션의 시간 표현을 LocalTime에서 LocalDateTime으로 변경하며, 필드명을 단순화했습니다. AttendanceRoundResponse의 필드를 roundId와 roundDate로 이름을 변경하고, AttendanceSession의 상태 계산 및 시간 윈도우 검증 로직을 재구성했습니다.

변경 사항

집단 / 파일 변경 요약
체크인 엔드포인트 추가
backend/src/main/java/org/sejongisc/backend/attendance/controller/AttendanceController.java
POST /api/attendance/sessions/{sessionId}/check-in 엔드포인트 추가. AttendanceRequest를 수락하고 HTTP 201 Created 상태로 AttendanceResponse 반환. 요청/결과 로깅 및 Swagger @Operation 포함.
체크인 서비스 구현
backend/src/main/java/org/sejongisc/backend/attendance/service/AttendanceService.java
checkIn(UUID sessionId, AttendanceRequest request, UUID userId) 메서드 추가. 사용자/세션 검증, 코드 확인, 중복 체크인 방지, 위치 및 시간 윈도우 검증, 상태(PRESENT/LATE) 결정 수행.
출석 라운드 응답 필드 이름 변경
backend/src/main/java/org/sejongisc/backend/attendance/dto/AttendanceRoundResponse.java
private UUID id → private UUID roundId, private LocalDate date → private LocalDate roundDate. 빌더 매핑도 함께 업데이트.
출석 라운드 테스트 업데이트
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceRoundControllerTest.java
AttendanceRoundResponse의 필드명 변경에 맞춰 테스트 코드 업데이트. .id(...) → .roundId(...), .date(...) → .roundDate(...) 및 JSON 경로 $.id → $.roundId 변경.
세션 요청 DTO 필드 및 타입 변경
backend/src/main/java/org/sejongisc/backend/attendance/dto/AttendanceSessionRequest.java
LocalTime defaultStartTime → LocalDateTime startsAt, Integer allowedMinutes → Integer windowSeconds. 검증 규칙 업데이트 (minSeconds: 300, maxSeconds: 14400).
출석 엔티티 지연 판정 단순화
backend/src/main/java/org/sejongisc/backend/attendance/entity/Attendance.java
isLate() 메서드 단순화. 이제 checkedAt.isAfter(attendanceSession.getStartsAt())로만 판정 (5분 임계값 제거).
세션 엔티티 시간 관리 재구성
backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java
LocalTime defaultStartTime → LocalDateTime startsAt, Integer allowedMinutes → Integer windowSeconds. getEndTime() 제거, getEndsAt() 추가 (startsAt + windowSeconds). calculateCurrentStatus() 메서드 추가 (UPCOMING, OPEN, CLOSED 상태 판정). isCheckInAvailableForRound(LocalTime) → isCheckInAvailable() 변경. getRemainingSeconds() 메서드 추가.
세션 서비스 로직 업데이트
backend/src/main/java/org/sejongisc/backend/attendance/service/AttendanceSessionService.java
세션 생성/조회/활성화 로직을 새로운 startsAt/windowSeconds 필드 사용으로 변경. 정렬 기준을 생성 순서에서 startsAt 내림차순으로 변경. 활성화 시 startsAt을 현재 시간으로 설정. 활성 세션 필터링 로직을 시간 윈도우 기반으로 재구성.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller as AttendanceController
    participant Service as AttendanceService
    participant DB as Database
    participant UserService

    Client->>Controller: POST /api/attendance/sessions/{id}/check-in
    Controller->>Controller: Extract userId from auth
    Controller->>Service: checkIn(sessionId, request, userId)
    
    Service->>UserService: Validate user exists
    alt User not found
        Service-->>Controller: Exception
        Controller-->>Client: Error response
    end
    
    Service->>DB: Fetch AttendanceSession
    alt Session not found
        Service-->>Controller: Exception
        Controller-->>Client: Error response
    end
    
    Service->>Service: Verify check-in code
    Service->>Service: Prevent duplicate check-ins
    Service->>Service: Validate location (if required)
    Service->>Service: Check time window (startsAt ≤ now ≤ endsAt)
    Service->>Service: Determine status (PRESENT or LATE)
    
    alt Validation fails
        Service-->>Controller: Exception
        Controller-->>Client: Error response
    end
    
    Service->>DB: Create & persist Attendance entity
    Service-->>Controller: AttendanceResponse
    Controller-->>Client: HTTP 201 Created
Loading

코드 리뷰 예상 소요 시간

🎯 4 (복잡함) | ⏱️ ~60분

특히 주의 깊게 검토해야 할 사항:

  • AttendanceSession의 시간 관리 로직 재구성: getEndsAt(), calculateCurrentStatus(), getRemainingSeconds() 메서드의 정확성 검증
  • AttendanceService.checkIn() 메서드의 비즈니스 로직: 시간 윈도우 검증, 지연 판정, 중복 체크인 방지 로직의 일관성 확인
  • AttendanceSessionService의 활성 세션 필터링 로직: startsAt 및 windowSeconds를 이용한 시간 기반 필터링 정확성
  • Attendance.isLate() 단순화로 인한 기존 동작의 정확한 구현 확인 (5분 임계값 제거의 영향)
  • 데이터베이스 마이그레이션: LocalTime → LocalDateTime, allowedMinutes → windowSeconds 필드 변경의 정확성
  • AttendanceRoundResponse 필드명 변경이 API 클라이언트에 미치는 영향

관련 가능성이 있는 PR

권장 리뷰어

  • discipline24

🐰 시간을 LocalDateTime으로,

필드명을 명확히 다듬고,

체크인 로직으로 출석을 확인하네!

지연도 단순하게, 상태도 정확하게,

우리의 세션은 더욱 튼튼해졌어요! 🎉

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-143-SISC1-224-BE-출석-라운드-관련-수정

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b342bda and 9e7d14a.

📒 Files selected for processing (8)
  • backend/src/main/java/org/sejongisc/backend/attendance/controller/AttendanceController.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/dto/AttendanceRoundResponse.java (3 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/dto/AttendanceSessionRequest.java (3 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/Attendance.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/entity/AttendanceSession.java (2 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/service/AttendanceService.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/attendance/service/AttendanceSessionService.java (10 hunks)
  • backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceRoundControllerTest.java (8 hunks)

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant