Skip to content

Fix/panel npe 버그 수정#121

Merged
c5ln merged 8 commits into
developfrom
fix/panel-npe-버그-수정
Aug 27, 2025

Hidden character warning

The head ref may contain hidden characters: "fix/panel-npe-\ubc84\uadf8-\uc218\uc815"
Merged

Fix/panel npe 버그 수정#121
c5ln merged 8 commits into
developfrom
fix/panel-npe-버그-수정

Conversation

@c5ln
Copy link
Copy Markdown
Member

@c5ln c5ln commented Aug 27, 2025

Fix/panel npe 버그 수정

UserQuiz out of bound 문제 해결

Summary by CodeRabbit

  • 버그 수정
    • 오늘 작성한 일기나 퀴즈가 없는 경우 발생하던 예외를 방지하여 홈 화면 로딩 실패 이슈를 해결했습니다.
  • 개선
    • 오늘 날짜 기준으로 일기/퀴즈 데이터를 더욱 정확하게 조회하도록 로직을 개선했습니다.
    • 데이터가 없을 때도 자연스럽게 처리되어 빈 화면이나 오류 대신 안정적으로 화면이 표시됩니다.
    • 전반적인 안정성과 사용자 경험(UX)을 향상했습니다.

@c5ln c5ln self-assigned this Aug 27, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 27, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

HomeService now retrieves today’s diary and quiz via date-scoped repository queries and uses stream().findFirst().orElse(null) instead of list.get(0). DiaryRepository adds a JPQL method findTodayDiaryByUser(User, LocalDateTime, LocalDateTime) using createdAt and BETWEEN for filtering.

Changes

Cohort / File(s) Summary
Home service retrieval hardening
src/main/java/com/example/cp_main_be/domain/home/service/HomeService.java
Replaced list index access with stream().findFirst().orElse(null) for today’s diary and quiz; switched diary source to DiaryRepository.findTodayDiaryByUser with start/end of day bounds; preserved existing null checks and completion logic.
Diary repository date-range query
src/main/java/com/example/cp_main_be/domain/mission/diary/domain/repository/DiaryRepository.java
Added LocalDateTime import and new JPQL method findTodayDiaryByUser(User, LocalDateTime, LocalDateTime) filtering by createdAt BETWEEN startDate and endDate; no changes to existing methods.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant HS as HomeService
  participant DR as DiaryRepository
  participant QR as QuizRepository

  U->>HS: getHomeData()
  HS->>DR: findTodayDiaryByUser(user, startOfDay, endOfDay)
  DR-->>HS: List<Diary>
  HS->>HS: diary = list.stream().findFirst().orElse(null)

  HS->>QR: findAllTodayUserQuizByUser(user, startOfDay, endOfDay)
  QR-->>HS: List<UserQuiz>
  HS->>HS: quiz = list.stream().findFirst().orElse(null)

  alt diary or quiz is null
    HS->>HS: handle nulls in completion logic
  else both present
    HS->>HS: proceed with existing logic
  end
  HS-->>U: Home data response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested labels

Refactor

Poem

토끼는 깡충, 날짜를 딱! 오늘만 골라본다
리스트 첫째 말고, 살포시 findFirst 한다
비어도 괜찮아, null이면 조심하자
일기와 퀴즈 모아, 집으로 가져가자
깡총깡총 코드도 오늘처럼 단단하다 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3e1d3a0 and ad5689b.

📒 Files selected for processing (2)
  • src/main/java/com/example/cp_main_be/domain/home/service/HomeService.java (1 hunks)
  • src/main/java/com/example/cp_main_be/domain/mission/diary/domain/repository/DiaryRepository.java (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/panel-npe-버그-수정

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@c5ln c5ln merged commit 4d4d9ac into develop Aug 27, 2025
1 of 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.

1 participant