Skip to content

[Refactor] 완수율 로직 수정#169

Merged
wonee1 merged 1 commit into
mainfrom
refactor/mypage-168-project
Jun 3, 2026
Merged

[Refactor] 완수율 로직 수정#169
wonee1 merged 1 commit into
mainfrom
refactor/mypage-168-project

Conversation

@wonee1

@wonee1 wonee1 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

🔗 관련 이슈

관련된 이슈 번호를 적어주세요.

closes #

📌 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요.

🧪 테스트 결과

Postman 스크린샷, 테스트 통과 여부 등을 첨부해주세요.

📸 스크린샷 (선택)

필요시 스크린샷을 첨부해주세요.

📎 참고 사항 (선택)

리뷰어에게 전달할 내용이 있다면 작성해주세요.

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 마이페이지 프로젝트 이력 요약의 평균 점수 계산 로직을 개선했습니다.
    • 완료된 프로젝트 개수 산출 방식을 최적화했습니다.

@wonee1 wonee1 self-assigned this Jun 3, 2026
@wonee1 wonee1 linked an issue Jun 3, 2026 that may be closed by this pull request
2 tasks
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

전체 변경사항 요약

MypageProjectHistoryService의 프로젝트 히스토리 요약 계산 로직이 리팩토링되었다. DONE 상태 프로젝트 집계를 카운트 기반 조회에서 멤버십 목록 기반 조회로 변경하고, 평균 점수를 progressRate 평균값으로 계산하도록 개선했다.

변경사항

프로젝트 히스토리 요약 계산 로직 개선

Layer / File(s) 요약
DONE 프로젝트 요약 계산 리팩토링
src/main/java/com/capstone/pickIt/api/user/service/MypageProjectHistoryService.java
getProjectHistorySummary 메서드에서 DONE 프로젝트 관련 수 집계 방식을 변경했다. 기존 카운트 기반(countDoneConfirmedByUserId, countConfirmedByUserId의 비율)에서 findActiveConfirmedMembershipsWithTeamAndCourse(userId, ProjectTeamStatus.DONE)을 통한 멤버십 목록 직접 조회로 전환했으며, 각 팀의 progressRate를 평균내어 averageScore를 계산한다(널 처리: 0.0). 응답의 projectCountdoneProjectCount 기반에서 members.size() 기반으로 변경되었고, averageContribution 계산 로직은 유지되었다.

추천 관련 PR

  • capstone-pick-it/Backend#103: 이 PR에서 도입된 카운트 기반 getProjectHistorySummary 로직을 현재 PR에서 멤버십 목록 기반으로 리팩토링했다.

리뷰 유의사항

확인하면 좋을 점들:

  1. progressRate 평균 계산의 의도: 기존 "완료한 프로젝트 수 / 전체 프로젝트 수" 비율이 아닌 "각 프로젝트의 진행률 평균"으로 변경된 것이 의도된 변경인지 확인 필요. 두 방식의 의미가 다를 수 있다.

  2. null 처리 로직: progressRate가 null인 경우 0.0으로 처리하는 것이 비즈니스 요구사항과 일치하는지 검토 권장.

  3. 성능 고려: findActiveConfirmedMembershipsWithTeamAndCourse 호출이 countDoneConfirmedByUserId + countConfirmedByUserId 카운트 쿼리 대비 성능상 더 효율적인지 검토. 큰 목록 조회 시 메모리 사용량도 비교하면 좋다.

  4. 팀 영속성 설정: 반환된 멤버십 객체의 team 정보가 제대로 로드되어 있는지 확인 필요(지연 로딩 여부).

🎯 2 (Simple) | ⏱️ ~10분

점수 계산 방식이 비율에서 평균으로 갈아탔네요 🔄
더 이상 나눗셈의 노예가 아니라
평균의 자유를 찾았도다 ✨
(카운트 쿼리가 남기는 향수는 잠시 안녕) 👋

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning PR 설명이 필수 섹션 구조는 유지하지만 모든 항목이 비워져 있거나 미완성 상태입니다. 작업 내용, 테스트 결과, 관련 이슈 등 중요 정보가 기입되지 않았습니다. 관련 이슈 번호, 상세한 작업 내용(변경 전후 로직 비교), Postman 테스트 스크린샷, 필요시 참고 사항을 구체적으로 작성해주세요.
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 (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed 제목이 PR의 주요 변경사항과 관련이 있으며, 완수율 로직 수정이라는 핵심 내용을 명확하게 전달합니다.

✏️ 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 refactor/mypage-168-project

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.

@wonee1 wonee1 changed the title refactor : 완수율 로직 수정 [Refactor] 완수율 로직 수정 Jun 3, 2026
@wonee1 wonee1 merged commit d573a17 into main Jun 3, 2026
2 of 3 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.

[Refactor] 프로젝트 완수율 로직 수정

1 participant