Skip to content

[FIX#333] 마이페이지 총인증일, 연속인증일 오류#336

Merged
7ijin01 merged 1 commit into
mainfrom
FIX#333
Jan 29, 2026
Merged

[FIX#333] 마이페이지 총인증일, 연속인증일 오류#336
7ijin01 merged 1 commit into
mainfrom
FIX#333

Conversation

@7ijin01

@7ijin01 7ijin01 commented Jan 29, 2026

Copy link
Copy Markdown
Collaborator

📝 작업 내용

  • 루틴 인증글 삭제 시, 오늘뿐 아니라 이전 날짜 글 삭제해도 남은 인증글 기준으로 총 인증일/연속 인증일/마지막 인증일/현재 루틴 커뮤니티 ID를 다시 계산해 반영

🎯 관련 이슈

Closes #333

Summary by CodeRabbit

버그 수정

  • 루틴 인증글 삭제 시 사용자의 연속 인증 일수 및 루틴 활동 정보가 더 정확하게 재계산되도록 개선했습니다.
  • 다양한 커뮤니티에서의 루틴 포스트 삭제 상황에서도 사용자의 루틴 데이터가 올바르게 유지됩니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@7ijin01 7ijin01 self-assigned this Jan 29, 2026
@7ijin01 7ijin01 added 🐛 bug 버그 BE 백엔드 labels Jan 29, 2026
@7ijin01 7ijin01 linked an issue Jan 29, 2026 that may be closed by this pull request
1 task
@vercel

vercel Bot commented Jan 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
youthit Ready Ready Preview, Comment Jan 29, 2026 2:14pm

@coderabbitai

coderabbitai Bot commented Jan 29, 2026

Copy link
Copy Markdown

Walkthrough

루틴 인증글 삭제 시 처리 로직을 리팩토링했어. 기존의 하드코딩된 "어제/오늘" 롤백 대신 남은 게시글 기반으로 연속 인증일과 마지막 인증 날짜를 재계산하는 방식으로 변경. 새 헬퍼 함수 2개(countConsecutiveDaysFromLatest, calculateConsecutiveDays)를 추가해서 계산 로직을 일반화했다.

Changes

Cohort / File(s) Summary
루틴 인증글 삭제 로직 리팩토링
be/functions/src/services/communityService.js
하드코딩된 날짜 기반 롤백을 제거하고, routineUserUpdate 객체를 통한 통합 업데이트 방식으로 변경. 새 헬퍼 함수 countConsecutiveDaysFromLatest() (남은 게시글의 연속 날짜 계산), calculateConsecutiveDays() (새 연속 일수 및 커뮤니티 결정)를 추가. 삭제 시 같은 커뮤니티면 마지막 인증일, 연속 인증일, 현재 커뮤니티를 재계산하고, 다른 커뮤니티면 인증글 수만 감소. 에러 메시지와 로깅을 "재계산" 컨텍스트에 맞게 조정했고, 기존 비루틴 인증 경로는 유지.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning PR 설명에서 작업 내용과 관련 이슈(#333)가 명시되어 있으나, 변경사항 상세 설명, 리뷰 포인트 등 템플릿의 여러 필수 섹션이 누락되어 있음. 변경사항(🔄), 리뷰 포인트(👀) 섹션을 추가로 작성해서 템플릿을 완성하자. 스크린샷 섹션은 백엔드 작업이니 생략해도 괜찮음.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 핵심 변경사항을 명확하게 설명하고 있음. 루틴 인증글 삭제 시 마이페이지 통계 오류 수정에 대한 구체적인 내용을 담고 있음.
Linked Issues check ✅ Passed PR의 코드 변경이 #333 이슈의 요구사항을 충족하고 있음. 남은 인증글 기준으로 총/연속 인증일, 마지막 인증일, 커뮤니티 ID를 재계산하는 로직 구현이 완료되었음.
Out of Scope Changes check ✅ Passed communityService.js의 루틴 인증글 삭제 로직 리팩토링이 이슈 #333의 범위 내에서 진행되었으며, 기존 비루틴 인증 경로는 유지됨.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@github-actions

Copy link
Copy Markdown

🔧 빌드 상태: 성공! ✅

Firebase Functions 빌드 및 에뮬레이터 기동이 성공적으로 완료되었습니다! 🎉

✅ 체크 완료

  • 🔧 Backend Build (Emulator): 성공

📊 상세 정보

  • Commit: d44c57c
  • Branch: FIX#333
  • 빌드 완료 시간: 2026. 1. 29. 오후 11:15:31

🚀 Functions 빌드 및 실행에 문제가 없습니다. 머지 가능합니다!

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@be/functions/src/services/communityService.js`:
- Around line 2352-2413: When deleting a routine post, the code currently sets
lastRoutineAuthDate/currentRoutineCommunityId to null if the current community
has no remaining posts, ignoring routine posts in other communities; update the
routineUserUpdate logic in the ROUTINE branch to, when remainingInCommunity is
empty but remainingAll has remaining dates, pick the latest post from
remainingAll (use remainingAll sorted by getDateKey) to set
newCurrentRoutineCommunityId and lastRoutineAuthDate and compute
consecutiveRoutinePosts via countConsecutiveDaysFromLatest on that community's
date set; keep existing decrement logic (shouldDecrementCertificationPosts) and
mirror this same fallback change for the other occurrence around the 2449-2457
region so both code paths recompute based on the latest remaining post across
all communities when the current community is emptied.

Comment thread be/functions/src/services/communityService.js
@7ijin01
7ijin01 merged commit 72b0615 into main Jan 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BE 백엔드 🐛 bug 버그

Projects

None yet

Development

Successfully merging this pull request may close these issues.

마이페이지 총인증일, 연속인증일 오류

1 participant