Skip to content

[Fix/#105, #106] 자녀 스티커 startDate null 필터링 및 성장탭 CHILD 유저 필터링 추가 - #107

Merged
yunmi-dev merged 1 commit into
developfrom
fix/#105-106-sticker-growth-filter
Apr 5, 2026
Merged

yunmi-dev merged 1 commit into
developfrom
fix/#105-106-sticker-growth-filter

Conversation

@yunmi-dev

@yunmi-dev yunmi-dev commented Apr 5, 2026 •

Copy link
Copy Markdown
Collaborator

📌 관련 이슈

✨ 변경 사항

  • 자녀 스티커 현황 조회 시 startDate가 null인 자녀 미노출 처리
  • 성장탭 부모 자녀 성장 현황 조회 시 UserType.CHILD만 반환하도록 필터링 추가

📚 리뷰어 참고 사항

  • 부모끼리 연결된 경우 성장탭에서 상대 부모가 자녀로 노출되던 버그 수정
  • 할 일을 한 번도 완료하지 않은 자녀는 스티커 현황에서 미노출

✅ 체크리스트

  • 브랜치 전략(git flow)을 따랐나요?
  • 로컬에서 빌드 및 실행이 정상적으로 되나요?
  • 불필요한 주석이나 더미 코드는 제거했나요?
  • 컨벤션(커밋 메시지, 코드 스타일)을 지켰나요?
  • spotlessApply 실행했나요?

Summary by CodeRabbit

  • Bug Fixes
    • Growth tracking and habit completion reports now accurately filter and display data exclusively for child user accounts, ensuring improved accuracy in household progress monitoring
    • Sticker collections have been refined to properly exclude incomplete entries without valid date information, providing cleaner and more reliable visual records

@coderabbitai

coderabbitai Bot commented Apr 5, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The changes fix two data filtering bugs: adding UserType.CHILD filtering to GrowthService to exclude parent users from children growth results, and adding null startDate filtering to StickerQueryService to exclude incomplete sticker board entries.

Changes

Cohort / File(s) Summary
Growth Service Child Filtering
src/main/java/com/swyp/server/domain/growth/service/GrowthService.java
Added UserType.CHILD filtering when building both the childIds list for aggregation and the final children list in ChildrenGrowthResponse, ensuring only users with CHILD user type are included (excludes parents).
Sticker Query Service Null-Date Filter
src/main/java/com/swyp/server/domain/sticker/service/StickerQueryService.java
Added stream filter to exclude ChildStickerResponse entries with null startDate values, preventing incomplete sticker board data from being returned.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • PR #100 — Both PRs modify StickerQueryService#getChildrenStickers filtering logic, adding UserType.CHILD constraint in one and null startDate filtering in the other.
  • PR #98 — Both PRs refine GrowthService#getChildrenGrowth to tighten child selection criteria (UserType.CHILD filtering applied here).
  • PR #64 — Directly related as it implements the same ChildStickerResponse null startDate exclusion in StickerQueryService.

Suggested reviewers

  • guzzang
  • SeHyeonCho

Poem

🐰 A parent's list grew long and wide,
But children filtered were denied—
Null dates removed with gentle care,
Now growth and stickers show what's fair! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the two bug fixes (#105, #106) and succinctly describes both main changes: filtering null startDate in sticker responses and adding CHILD user filtering in growth tab.
Linked Issues check ✅ Passed The code changes directly address both linked issues: StickerQueryService now filters null startDate values, and GrowthService now applies UserType.CHILD filtering to prevent parent users from appearing as children.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to the two linked issues: adding null startDate filtering in StickerQueryService and UserType.CHILD filtering in GrowthService with no extraneous modifications.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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/#105-106-sticker-growth-filter

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/java/com/swyp/server/domain/growth/service/GrowthService.java (1)

79-87: Consider de-duplicating child filtering logic.

The same child predicate is repeated twice. Precomputing a single List<User> of valid child users would reduce drift risk and simplify future edits.

♻️ Suggested refactor
 List<FamilyRelation> relations = familyRelationRepository.findAllByOwnerUserId(parentId);
-List<Long> childIds =
-        relations.stream()
-                .filter(
-                        r ->
-                                r.getTargetUser() != null
-                                        && r.getTargetUser().getUserType()
-                                                == UserType.CHILD)
-                .map(r -> r.getTargetUser().getId())
-                .toList();
+List<User> childUsers =
+        relations.stream()
+                .map(FamilyRelation::getTargetUser)
+                .filter(u -> u != null && u.getUserType() == UserType.CHILD)
+                .toList();
+
+List<Long> childIds = childUsers.stream().map(User::getId).toList();

 ...
 List<ChildGrowthResponse> children =
-        relations.stream()
-                .filter(
-                        r ->
-                                r.getTargetUser() != null
-                                        && r.getTargetUser().getUserType()
-                                                == UserType.CHILD)
-                .map(
-                        relation -> {
-                            User child = relation.getTargetUser();
+        childUsers.stream()
+                .map(
+                        child -> {
                             int todoStarCount =
                                     calculateTodoStarCount(
                                             child.getId(), startDate, endDate);
                             int habitCompletedDays =
                                     habitCompletionCountMap
                                             .getOrDefault(child.getId(), 0L)
                                             .intValue();
                             int habitStarCount =
                                     calculateHabitStarCount(habitCompletedDays);
                             return new ChildGrowthResponse(
                                     child.getId(),
                                     child.getNickname(),
                                     todoStarCount,
                                     habitStarCount,
                                     weekRange);
                         })
                 .toList();

Also applies to: 100-127

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/swyp/server/domain/growth/service/GrowthService.java`
around lines 79 - 87, Refactor the duplicated child-predicate by precomputing a
single collection of valid child users from relations (e.g., build a List<User>
of entries where r.getTargetUser() != null && r.getTargetUser().getUserType() ==
UserType.CHILD) and then derive childIds from that list; replace the repeated
filters at the getTargetUser()/UserType.CHILD checks (used around variables like
childIds and other logic in the 100-127 region) to consume the precomputed list
so the predicate is declared once and reused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/main/java/com/swyp/server/domain/growth/service/GrowthService.java`:
- Around line 79-87: Refactor the duplicated child-predicate by precomputing a
single collection of valid child users from relations (e.g., build a List<User>
of entries where r.getTargetUser() != null && r.getTargetUser().getUserType() ==
UserType.CHILD) and then derive childIds from that list; replace the repeated
filters at the getTargetUser()/UserType.CHILD checks (used around variables like
childIds and other logic in the 100-127 region) to consume the precomputed list
so the predicate is declared once and reused.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13b78fd8-541d-4b71-9d01-81a8437d49ea

📥 Commits

Reviewing files that changed from the base of the PR and between 5927975 and 44a14c0.

📒 Files selected for processing (2)
  • src/main/java/com/swyp/server/domain/growth/service/GrowthService.java
  • src/main/java/com/swyp/server/domain/sticker/service/StickerQueryService.java

@guzzang guzzang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

고생하셨습니다!

@yunmi-dev
yunmi-dev merged commit e28a165 into develop Apr 5, 2026
2 checks passed
@yunmi-dev
yunmi-dev deleted the fix/#105-106-sticker-growth-filter branch April 5, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants