Commit 2effe3f
authored
## 📌 관련 이슈
- close #90
## ✨ 변경 사항
- HabitDailyCompletion unique key를 user_id+날짜 → habit_id+날짜로 변경
- HabitService.updateHabit 완료 이력 저장/삭제 시 habit_id 기준으로 변경
- HabitDailyCompletionRepository countCompletionsByUserIds를
COUNT(DISTINCT completion_date)로 수정
- GrowthService.getHabitGrowth distinct 날짜 수 기반으로 별 계산
## 📚 리뷰어 참고 사항
- 기존 habit_daily_completions 테이블 스키마 변경 필요
- 민구님 기존 습관 로직(updateHabit, resetDailyHabits) 변경 없음
## ✅ 체크리스트
- [x] 브랜치 전략(git flow)을 따랐나요?
- [x] 로컬에서 빌드 및 실행이 정상적으로 되나요?
- [x] 불필요한 주석이나 더미 코드는 제거했나요?
- [x] 컨벤션(커밋 메시지, 코드 스타일)을 지켰나요?
- [x] spotlessApply 실행했나요?
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Deduplicated daily completion counts by date so progress and stars
reflect distinct days.
* Tied completion records to specific habits, ensuring correct creation
and deletion of daily completions.
* **Refactor**
* Completion updates now depend on actual state changes (completed ↔ not
completed) to avoid redundant writes/deletes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 97404f4 commit 2effe3f
4 files changed
Lines changed: 31 additions & 25 deletions
File tree
- src/main/java/com/swyp/server/domain
- growth/service
- habit
- entity
- repository
- service
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
40 | 44 | | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | | - | |
45 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
Lines changed: 12 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
185 | 187 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
192 | 193 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 194 | | |
199 | 195 | | |
200 | 196 | | |
| |||
0 commit comments