Skip to content

아이템 교체 시 교체 수량도 감소되도록 수정 - #156

Merged
eclipse021 merged 1 commit into
mainfrom
junhyeon/fix/155/decrease-spareQuantity
Jun 19, 2026
Merged

아이템 교체 시 교체 수량도 감소되도록 수정#156
eclipse021 merged 1 commit into
mainfrom
junhyeon/fix/155/decrease-spareQuantity

Conversation

@eclipse021

@eclipse021 eclipse021 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Closes #155

Summary

기존에 아이템 교체 시 수량은 변화가 없어서 교체 버튼 클릭 시 수량도 감소되도록 수정

Changes

Etc

Summary by CodeRabbit

버그 수정

  • 소모품 교체 시 여분 수량이 음수로 내려가지 않도록 개선
  • 교체 날짜 기준으로 교체 이력 및 다음 교체 예정일이 올바르게 갱신되도록 강화

테스트

  • 교체 기능에 대한 테스트 커버리지 추가

@eclipse021 eclipse021 self-assigned this Jun 19, 2026
@eclipse021
eclipse021 requested a review from a team as a code owner June 19, 2026 14:09
@eclipse021
eclipse021 requested review from jminkkk and ziweek June 19, 2026 14:09
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f8e334c6-54d2-46df-9249-f075c51e2763

📥 Commits

Reviewing files that changed from the base of the PR and between 7986023 and f739eb7.

📒 Files selected for processing (2)
  • src/main/kotlin/depromeet/hotsix/obrit/item/entity/Item.kt
  • src/test/kotlin/depromeet/hotsix/obrit/item/service/ItemServiceTest.kt

Walkthrough

Item.replace() 메서드에 quantity를 1 감소시키되 coerceAtLeast(0)으로 음수를 방지하는 로직을 추가했다. 이에 대한 검증으로 ItemServiceTest에 여분 수량 차감 및 수량 0 이하 방지를 각각 확인하는 테스트 2건을 추가했다.

Changes

교체 수량 차감 구현 및 검증

Layer / File(s) Summary
Item.replace() 수량 차감 로직
src/main/kotlin/depromeet/hotsix/obrit/item/entity/Item.kt
replace 호출 시 quantity를 1 감소시키고 coerceAtLeast(0)으로 최솟값을 0으로 보장하는 한 줄이 추가됐다.
replaceItem 서비스 테스트 추가
src/test/kotlin/depromeet/hotsix/obrit/item/service/ItemServiceTest.kt
CreateReplacementRequest import 추가 및 replaceItem 신규 테스트 2건(정상 수량 차감 및 lastReplacedDate/nextReplacementDate 갱신 검증, 수량 0일 때 음수 방지 검증)이 추가됐다.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested reviewers

  • ziweek

Poem

🐇 토끼가 소모품을 교체했어요,
수량이 쏙 하나 줄었지요.
0 아래론 절대 안 가요,
coerceAtLeast가 지켜줘요!
테스트도 통과, 완벽해요 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 주요 변경사항을 명확하게 요약하고 있습니다. 아이템 교체 시 교체 수량이 감소되는 기능을 간결하고 구체적으로 설명합니다.
Linked Issues check ✅ Passed PR이 #155의 모든 요구사항을 충족합니다: (1) 감소 로직이 Item.replace() 메서드에 추가되어 quantity를 coerceAtLeast(0)으로 처리했고, (2) 교체 기능을 검증하는 2개의 테스트가 추가되었습니다.
Out of Scope Changes check ✅ Passed PR의 모든 변경사항이 #155의 요구사항과 직접 관련되어 있습니다. Item 엔티티의 교체 메서드 수정과 해당 테스트만 포함되어 있어 범위를 벗어난 변경이 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 junhyeon/fix/155/decrease-spareQuantity

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@ziweek ziweek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

굿굿 👍

@eclipse021
eclipse021 merged commit 2538328 into main Jun 19, 2026
2 checks passed
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.

[FIX] 아이템 교체 시 교체 수량도 감소되도록 수정

2 participants