Skip to content

Conversation

@sunohkim
Copy link
Collaborator

@sunohkim sunohkim commented Feb 20, 2025

[BE] 질문 데이터를 조회&삭제하는 과정에서 발생하는 문제 해결

#️⃣ 연관된 이슈

#205

📝 작업 내용

교수가 강의 상세 정보를 불러올 때, 이미 해결된 질문까지 같이 조회하는 문제 해결

  • 질문 조회 시 해결 여부를 검사

💬 리뷰 요구사항(선택)

Summary by CodeRabbit

  • New Features
    • Improved course question listings by now displaying only pending items, ensuring that instructors see the most relevant, up-to-date questions for management.

@sunohkim sunohkim added 🐞 Fix 버그 수정 (기능 오류 및 예외 처리 등) 🌱 BE 백엔드 관련 labels Feb 20, 2025
@sunohkim sunohkim self-assigned this Feb 20, 2025
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2025

Walkthrough

This pull request updates the logic for retrieving course questions. In the ProfessorCourseService, the method now obtains questions by querying the database for incomplete questions, instead of fetching from the Course object directly. A new repository method findNotCompleteByCourse is introduced in the QuestionRepository to support this functionality.

Changes

File(s) Change Summary
back-end/reacton/.../ProfessorCourseService.java Updated getQuestionsByCourseInOrder to fetch questions via findNotCompleteByCourse, replacing the direct access of course.getQuestions().
back-end/reacton/.../QuestionRepository.java Added a new method findNotCompleteByCourse(Course course) annotated with @Query to retrieve questions where isComplete is false.

Sequence Diagram(s)

sequenceDiagram
    participant Service as ProfessorCourseService
    participant Repo as QuestionRepository
    participant DB as Database

    Service ->> Repo: findNotCompleteByCourse(course)
    Repo ->> DB: Execute query for incomplete questions
    DB -->> Repo: Return list of questions
    Repo -->> Service: Return list of questions
Loading

Possibly related PRs

Suggested reviewers

  • uri010

Poem

I'm a little rabbit in the code forest,
Hopping through changes with a joyful chorus,
Incomplete queries now leap in neat rows,
Database secrets the new method bestows,
Through lines of code, I celebrate our quest,
Carrots and commits—it’s simply the best!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97d6b7a and 3b99129.

📒 Files selected for processing (2)
  • back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java (1 hunks)
  • back-end/reacton/src/main/java/com/softeer/reacton/domain/question/QuestionRepository.java (1 hunks)
🔇 Additional comments (3)
back-end/reacton/src/main/java/com/softeer/reacton/domain/question/QuestionRepository.java (1)

13-15: LGTM! Well-structured query method.

The new query method is correctly implemented with proper JPQL syntax and follows the repository's established patterns for filtering incomplete questions.

back-end/reacton/src/main/java/com/softeer/reacton/domain/course/ProfessorCourseService.java (2)

256-256: LGTM! Improved question filtering.

The change correctly uses the new repository method to fetch only incomplete questions, which aligns with the PR objective.


158-167:

Details

❓ Verification inconclusive

Verify the different question deletion strategies.

There are two different strategies for question deletion:

  • startCourse: Deletes all questions (complete and incomplete)
  • closeCourse: Only deletes complete questions

Please verify if this difference in behavior is intentional and aligns with the business requirements.

Also applies to: 169-182


🏁 Script executed:

#!/bin/bash
# Search for any comments or documentation explaining the question deletion strategy
rg -i "question.*delet|delet.*question" -g "!*.{class,jar}" -A 3 -B 3

Length of output: 7973


Action Required: Confirm Intentional Difference in Question Deletion Behavior

The code uses two distinct deletion strategies:

  • In startCourse, all questions (both complete and incomplete) are removed via questionRepository.deleteAllByCourse(course).
  • In closeCourse (and similarly in related methods), only complete questions are removed via questionRepository.deleteCompleteByCourse(course).

Please verify that this discrepancy is intentional and that it aligns with the expected course lifecycle requirements and business logic. Also, ensure that any documentation or design decisions reflecting this behavior are properly referenced.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@sunohkim sunohkim requested a review from uri010 February 20, 2025 08:54
Copy link
Collaborator

@uri010 uri010 left a comment

Choose a reason for hiding this comment

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

학생만 적용했었군요... 저도 이랬답니다🥲

@sunohkim sunohkim merged commit 51078e3 into dev Feb 20, 2025
2 checks passed
@sunohkim sunohkim deleted the fix/be/professor-question branch February 20, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌱 BE 백엔드 관련 🐞 Fix 버그 수정 (기능 오류 및 예외 처리 등)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants