Skip to content

Fix : 출석 지각, 결석 시간 적용#430

Merged
wjdwnsdnjs13 merged 3 commits intodevelopfrom
fix/attendace/#429-late-and-absent-time
Mar 19, 2026
Merged

Fix : 출석 지각, 결석 시간 적용#430
wjdwnsdnjs13 merged 3 commits intodevelopfrom
fix/attendace/#429-late-and-absent-time

Conversation

@wjdwnsdnjs13
Copy link
Member

@wjdwnsdnjs13 wjdwnsdnjs13 commented Mar 19, 2026

Summary

Tasks

  • 지각, 결석 시간 적용 로직 수정(실제 입력한 값 사용하도록)
  • 출석 시간 조회 시 출석, 지각, 결석 시간 내려주도록 변경

ETC

Screenshot

Summary by CodeRabbit

릴리스 노트

  • 개선 사항

    • 세션 출석 정책 조회 API가 확장되어 출석 시작 시간, 지각 시간, 결석 시간을 모두 제공합니다.
    • 출석 상태 판정 로직이 정책 기반 임계값으로 개선되어 더 정확한 출석 상태 판정이 가능합니다.
  • 기타

    • 코드 정렬 및 포맷팅 최적화가 진행되었습니다.

@wjdwnsdnjs13 wjdwnsdnjs13 self-assigned this Mar 19, 2026
@wjdwnsdnjs13 wjdwnsdnjs13 linked an issue Mar 19, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

설명

여러 파일에서 임포트 순서 정렬 및 코드 형식을 개선하고, 세션 참석 정책 처리 방식을 리팩토링하여 getAttendanceTime 메서드를 getAttendancePolicy로 변경 후 응답에 지각 및 결석 시간 필드 추가.

변경 사항

코호트 / 파일(들) 요약
임포트 정렬 및 형식 정리
application/src/main/kotlin/core/application/afterParty/.../AfterPartyCommandService.kt, application/src/main/kotlin/core/application/member/.../MemberQueryService.kt, application/src/main/kotlin/core/application/member/.../MemberApi.kt, domain/src/main/kotlin/core/domain/member/.../MemberPersistencePort.kt, domain/src/main/kotlin/core/domain/session/.../SessionCreateEvent.kt, persistence/src/main/kotlin/core/persistence/member/.../MemberRepository.kt
임포트 문의 순서 정렬 및 단일 행 표현식으로 코드 압축.
세션 참석 정책 리팩토링
application/src/main/kotlin/core/application/session/.../SessionQueryService.kt, application/src/main/kotlin/core/application/session/.../SessionQueryController.kt, application/src/main/kotlin/core/application/session/.../SessionMapper.kt, application/src/main/kotlin/core/application/session/.../AttendanceTimeResponse.kt, domain/src/main/kotlin/core/domain/session/aggregate/Session.kt
getAttendanceTime 메서드를 getAttendancePolicy로 변경하고, 응답에 attendanceLateTimeattendanceAbsentTime 필드 추가. 참석 상태 판단 로직을 계산된 시간 오프셋 대신 정책의 lateStart/absentStart 직접 비교로 변경.

예상 코드 리뷰 시간

🎯 2 (Simple) | ⏱️ ~12분

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title in Korean accurately describes the main change: applying late and absent time logic to the attendance system, which is the primary objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/attendace/#429-late-and-absent-time
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can approve the review once all CodeRabbit's comments are resolved.

Enable the reviews.request_changes_workflow setting to automatically approve the review once all CodeRabbit's comments are resolved.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
application/src/main/kotlin/core/application/session/application/service/SessionQueryService.kt (1)

55-59: 정책 조회 로직 중복을 합치면 유지보수성이 좋아집니다.

getAttendancePolicygetCurrentPolicy와 동일한 조회/예외 처리를 반복하고 있어, 한쪽만 수정되는 드리프트 위험이 있습니다.

♻️ 제안 수정안
 fun getAttendancePolicy(sessionId: SessionId): AttendancePolicy =
-    sessionPersistencePort
-        .findSessionById(sessionId.value)
-        ?.attendancePolicy
-        ?: throw SessionNotFoundException()
+    getCurrentPolicy(sessionId.value)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@application/src/main/kotlin/core/application/session/application/service/SessionQueryService.kt`
around lines 55 - 59, getAttendancePolicy duplicates the session lookup and
exception handling already implemented by getCurrentPolicy; refactor by
delegating to the existing getCurrentPolicy (or extract a shared private helper
like findSessionOrThrow that calls sessionPersistencePort.findSessionById and
throws SessionNotFoundException) and return its attendancePolicy, ensuring you
reference getAttendancePolicy, getCurrentPolicy,
sessionPersistencePort.findSessionById, SessionNotFoundException and
attendancePolicy so the lookup/exception logic is centralized and not
duplicated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@domain/src/main/kotlin/core/domain/session/aggregate/Session.kt`:
- Around line 67-69: The attendance-time ordering (attendanceStart < lateStart <
absentStart) is not being validated, so malformed AttendancePolicy values can
invert status decisions; update the code that consumes or constructs
attendancePolicy (e.g., the Session aggregate constructor/factory or the method
using attendancePolicy in Session.kt where
now.isBefore(attendancePolicy.lateStart) is evaluated) to validate the invariant
and fail fast: verify attendancePolicy.attendanceStart <
attendancePolicy.lateStart && attendancePolicy.lateStart <
attendancePolicy.absentStart and either throw a clear domain error / return a
failure result before performing the
AttendanceResult.Success(AttendanceStatus...) logic, or normalize/reject
incoming policy updates to ensure the invariant always holds.

---

Nitpick comments:
In
`@application/src/main/kotlin/core/application/session/application/service/SessionQueryService.kt`:
- Around line 55-59: getAttendancePolicy duplicates the session lookup and
exception handling already implemented by getCurrentPolicy; refactor by
delegating to the existing getCurrentPolicy (or extract a shared private helper
like findSessionOrThrow that calls sessionPersistencePort.findSessionById and
throws SessionNotFoundException) and return its attendancePolicy, ensuring you
reference getAttendancePolicy, getCurrentPolicy,
sessionPersistencePort.findSessionById, SessionNotFoundException and
attendancePolicy so the lookup/exception logic is centralized and not
duplicated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 14b173fd-eca8-4270-9085-229d82603370

📥 Commits

Reviewing files that changed from the base of the PR and between 24744d3 and 8dfc41a.

📒 Files selected for processing (11)
  • application/src/main/kotlin/core/application/afterParty/application/service/AfterPartyCommandService.kt
  • application/src/main/kotlin/core/application/member/application/service/MemberQueryService.kt
  • application/src/main/kotlin/core/application/member/presentation/controller/MemberApi.kt
  • application/src/main/kotlin/core/application/session/application/service/SessionQueryService.kt
  • application/src/main/kotlin/core/application/session/presentation/controller/SessionQueryController.kt
  • application/src/main/kotlin/core/application/session/presentation/mapper/SessionMapper.kt
  • application/src/main/kotlin/core/application/session/presentation/response/AttendanceTimeResponse.kt
  • domain/src/main/kotlin/core/domain/member/port/outbound/MemberPersistencePort.kt
  • domain/src/main/kotlin/core/domain/session/aggregate/Session.kt
  • domain/src/main/kotlin/core/domain/session/event/SessionCreateEvent.kt
  • persistence/src/main/kotlin/core/persistence/member/repository/MemberRepository.kt

Comment on lines +67 to 69
now.isBefore(attendancePolicy.lateStart) -> AttendanceResult.Success(AttendanceStatus.PRESENT)
now.isBefore(attendancePolicy.absentStart) -> AttendanceResult.Success(AttendanceStatus.LATE)
else -> AttendanceResult.Success(AttendanceStatus.ABSENT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

출석 정책 시간 순서 불변식 검증이 없어 상태 판정이 깨질 수 있습니다.

Line 67-69는 lateStart, absentStart를 직접 신뢰합니다.
그런데 현재 생성/수정 경로에서 attendanceStart < lateStart < absentStart 보장이 없어서, 잘못된 정책값이 들어오면 출석 상태가 역전되거나 즉시 결석 처리될 수 있습니다.

💡 제안 수정안
 class Session(
@@
     deletedAt: Instant? = null,
 ) {
+    init {
+        validateAttendancePolicy(attendancePolicy)
+    }
+
+    private fun validateAttendancePolicy(policy: AttendancePolicy) {
+        require(policy.attendanceStart.isBefore(policy.lateStart)) {
+            "attendanceStart must be before lateStart"
+        }
+        require(policy.lateStart.isBefore(policy.absentStart)) {
+            "lateStart must be before absentStart"
+        }
+    }
@@
     fun updateAttendanceStartTime(newStartTime: Instant) {
-        this.attendancePolicy =
-            attendancePolicy.copy(
-                attendanceStart = newStartTime,
-            )
+        val newPolicy = attendancePolicy.copy(attendanceStart = newStartTime)
+        validateAttendancePolicy(newPolicy)
+        this.attendancePolicy = newPolicy
     }
@@
     fun updateSession(command: SessionUpdateCommand) {
@@
-        this.attendancePolicy =
-            AttendancePolicy(
-                attendanceStart = command.attendanceStart,
-                lateStart = command.lateStart,
-                absentStart = command.absentStart,
-                attendanceCode = this.attendancePolicy.attendanceCode,
-            )
+        val newPolicy =
+            AttendancePolicy(
+                attendanceStart = command.attendanceStart,
+                lateStart = command.lateStart,
+                absentStart = command.absentStart,
+                attendanceCode = this.attendancePolicy.attendanceCode,
+            )
+        validateAttendancePolicy(newPolicy)
+        this.attendancePolicy = newPolicy
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@domain/src/main/kotlin/core/domain/session/aggregate/Session.kt` around lines
67 - 69, The attendance-time ordering (attendanceStart < lateStart <
absentStart) is not being validated, so malformed AttendancePolicy values can
invert status decisions; update the code that consumes or constructs
attendancePolicy (e.g., the Session aggregate constructor/factory or the method
using attendancePolicy in Session.kt where
now.isBefore(attendancePolicy.lateStart) is evaluated) to validate the invariant
and fail fast: verify attendancePolicy.attendanceStart <
attendancePolicy.lateStart && attendancePolicy.lateStart <
attendancePolicy.absentStart and either throw a clear domain error / return a
failure result before performing the
AttendanceResult.Success(AttendanceStatus...) logic, or normalize/reject
incoming policy updates to ensure the invariant always holds.

@wjdwnsdnjs13 wjdwnsdnjs13 merged commit 40abc1b into develop Mar 19, 2026
2 checks passed
@wjdwnsdnjs13 wjdwnsdnjs13 deleted the fix/attendace/#429-late-and-absent-time branch March 19, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

출석 지각, 결석 시간 적용 오류

1 participant