Skip to content

참가인원 계산 로직 수정#468

Merged
HA-SEUNG-JEONG merged 11 commits into
developfrom
fix/group-study
Apr 2, 2026
Merged

참가인원 계산 로직 수정#468
HA-SEUNG-JEONG merged 11 commits into
developfrom
fix/group-study

Conversation

@HA-SEUNG-JEONG

@HA-SEUNG-JEONG HA-SEUNG-JEONG commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • 버그 수정

    • 스터디 카드/진행 표시에서 남은 자리 수 계산을 안정화하여 음수 표기 제거 및 일관된 값이 표시됩니다.
    • 스터디 종료 처리 상태를 성공/실패와 관계없이 항상 초기화해 UI 일관성을 개선했습니다.
  • 리팩토링

    • 슬롯 계산 로직을 통합하고 관련 컴포넌트 입력을 간소화했습니다.
    • 마크다운 렌더링 흐름을 개선해 HTML 삽입과 하이라이팅이 안정적으로 동작합니다.
  • 스타일

    • 미션 카드 제출 기간 텍스트 정렬을 개선했습니다.
  • 잡무

    • 타입 선언, 빌드 설정, ESLint 규칙 및 구성 파일 정리를 포함한 환경 설정 변경을 적용했습니다.

@HA-SEUNG-JEONG HA-SEUNG-JEONG self-assigned this Apr 2, 2026
@vercel

vercel Bot commented Apr 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
study-platform-client-dev Error Error Apr 2, 2026 5:42am

@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Study 관련 컴포넌트들에서 선택적 remainingSlot prop을 제거하고 남은 자리 수를 항상 Math.max(0, maxMembersCount - approvedCount)로 계산하도록 통일했습니다. 프리미엄 상세 페이지의 종료 mutation은 confirmActiononSettled에서 클리어하도록 변경되었습니다.

Changes

Cohort / File(s) Summary
Study card & countdown
src/components/card/study-card.tsx
remainingSlots 옵셔널 사용 제거. 남은 자리 수를 Math.max(0, maxMembersCount - approvedCount)로 계산해 StudyCardCountdownBadge와 배지 로직에 전달하도록 변경.
Active ticker UI
src/components/common/ui/study-active-ticker.tsx
remainingSlot prop 제거. safeApprovedCount/safeMaxMembersCountremaining = Math.max(0, safeMaxMembersCount - safeApprovedCount) 계산하여 메시지와 카운트 표시에 사용하도록 변경. totalCount 표시는 safeApprovedCount로 조정.
Pages — ticker usage
src/components/pages/group-study-detail-page.tsx
StudyActiveTicker 호출에서 remainingSlot={studyDetail.basicInfo.remainingSlots} 제거; 다른 props(approvedCount, maxMembersCount, startDate, viewCount)는 유지.
Premium detail — mutation flow
src/components/pages/premium-study-detail-page.tsx
handleEndStudy의 상태 초기화 위치 변경: setConfirmAction(null)onSuccess에서 제거하고 onSettled로 이동시켜 성공/실패 관계없이 클리어되도록 함.
Markdown sanitization & rendering
src/components/common/ui/editor/markdown-content.tsx, src/features/mentoring/.../mentor-markdown-rendering.ts
DOMPurify 타입 임포트 조정(타입명 변경), DOMPurify.sanitize 결과를 String(...)으로 강제해 문자열로 처리. MarkdownContentdangerouslySetInnerHTML 대신 useEffect에서 container.innerHTML = sanitizedHtml로 삽입하고 하이라이팅을 적용하도록 변경.
Webpack/paths & TS config
next.config.ts, tsconfig.json
next.config.tspublic alias 추가(webpack resolve.alias). tsconfig.json target을 ES2017로, moduleResolution을 bundler로 변경하고 public/* 경로 매핑 추가.
Misc UI/imports/styles
src/components/card/mission-card.tsx, src/components/one-on-one/one-on-one-page.tsx
미사용 Button/Link import 제거. MissionCard 제출 기간 텍스트에 text-left 클래스 추가로 정렬 변경.
Tooling & types
.eslintrc.cjs, .husky/pre-commit, src/types/css.d.ts
no-console 규칙에 info 추가 허용, .husky/pre-commit 선행 공백 제거, *.css 모듈 타입 선언 추가.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🐰 자리 수는 이제 깔끔히 계산해요,
음수면 Math.max가 살포시 다듬고,
Props 줄어들어 길도 단정해졌네.
종료는 onSettled로, 마음도 편안히 —
당근 한 입 축하의 춤을 출게요! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 '참가인원 계산 로직 수정'으로, 변경사항의 주요 핵심인 remaining(남은 자리) 계산 로직 개선을 정확하게 설명합니다.

✏️ 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/group-study

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/common/ui/study-active-ticker.tsx (1)

20-21: ⚠️ Potential issue | 🟠 Major

remaining 계산 시 NaN 방어가 필요합니다.

Line 20에서 maxMembersCount/approvedCountundefinedremainingNaN이 되고, Line 46에서 NaN자리가 노출될 수 있습니다(호출부: src/components/pages/group-study-detail-page.tsx:307-314, 타입: src/api/openapi/models/group-study-basic-info-response-dto.ts:50-65).

수정 제안
 export default function StudyActiveTicker({
-  approvedCount,
-  maxMembersCount,
+  approvedCount = 0,
+  maxMembersCount = 0,
   viewCount = 0,
   className = '',
 }: StudyActiveTickerProps) {
-  const remaining = Math.max(0, maxMembersCount - approvedCount);
-  const totalCount = maxMembersCount - remaining;
+  const safeApproved = Number.isFinite(approvedCount) ? approvedCount : 0;
+  const safeMaxMembers = Number.isFinite(maxMembersCount) ? maxMembersCount : 0;
+  const remaining = Math.max(0, safeMaxMembers - safeApproved);
+  const totalCount = safeApproved;

Also applies to: 46-46

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

In `@src/components/common/ui/study-active-ticker.tsx` around lines 20 - 21, The
calculation for remaining and totalCount can produce NaN when maxMembersCount or
approvedCount are undefined; update the logic in StudyActiveTicker (the
remaining and totalCount assignments) to coerce inputs to numbers with safe
defaults (e.g., const max = Number(maxMembersCount ?? 0); const approved =
Number(approvedCount ?? 0)) and then compute remaining = Math.max(0, max -
approved) and totalCount = max - remaining (or use Math.max(0, max -
remaining)); also guard with Number.isFinite if you prefer to fallback to 0 to
ensure no NaN is rendered.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/common/ui/study-active-ticker.tsx`:
- Around line 20-21: The calculation for remaining and totalCount can produce
NaN when maxMembersCount or approvedCount are undefined; update the logic in
StudyActiveTicker (the remaining and totalCount assignments) to coerce inputs to
numbers with safe defaults (e.g., const max = Number(maxMembersCount ?? 0);
const approved = Number(approvedCount ?? 0)) and then compute remaining =
Math.max(0, max - approved) and totalCount = max - remaining (or use Math.max(0,
max - remaining)); also guard with Number.isFinite if you prefer to fallback to
0 to ensure no NaN is rendered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c90370b8-5766-4b2b-801b-af43c4c0312c

📥 Commits

Reviewing files that changed from the base of the PR and between 120eb26 and 01c3758.

📒 Files selected for processing (3)
  • src/components/card/study-card.tsx
  • src/components/common/ui/study-active-ticker.tsx
  • src/components/pages/group-study-detail-page.tsx
💤 Files with no reviewable changes (1)
  • src/components/pages/group-study-detail-page.tsx

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/common/ui/editor/markdown-content.tsx (1)

245-245: ⚠️ Potential issue | 🟡 Minor

Tailwind 임의 값 사용 - 코딩 가이드라인 위반

max-h-[400px]max-w-[min(100%,400px)]는 프로젝트 코딩 가이드라인에서 금지하는 임의 값(arbitrary values)입니다. 프로젝트 커스텀 디자인 토큰을 사용해야 합니다.

global.css에 커스텀 유틸리티 클래스를 정의하거나, 기존 디자인 토큰으로 대체하는 것을 권장합니다.

🛠️ 권장 수정 방안

global.css에 커스텀 유틸리티 추가:

`@layer` utilities {
  .max-h-markdown-img {
    max-height: 400px;
  }
  .max-w-markdown-img {
    max-width: min(100%, 400px);
  }
}

그 후 컴포넌트에서 사용:

-'[&_img]:rounded-100 [&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto [&_img]:max-h-[400px] [&_img]:max-w-[min(100%,400px)] [&_img]:border [&_img]:object-contain',
+'[&_img]:rounded-100 [&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto [&_img]:max-h-markdown-img [&_img]:max-w-markdown-img [&_img]:border [&_img]:object-contain',

As per coding guidelines: "Forbidden: Tailwind arbitrary values (e.g., p-[4px], w-[320px]). Use only project custom design tokens."

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

In `@src/components/common/ui/editor/markdown-content.tsx` at line 245, The
Tailwind arbitrary values in the MarkdownContent image class string (the array
entry containing '[&_img]:rounded-100 [&_img]:border-border-subtle
[&_img]:mb-100 [&_img]:block [&_img]:h-auto [&_img]:max-h-[400px]
[&_img]:max-w-[min(100%,400px)] [&_img]:border [&_img]:object-contain') violate
the coding guideline; add two custom utility classes in global.css (e.g.,
.max-h-markdown-img and .max-w-markdown-img) that implement max-height: 400px
and max-width: min(100%,400px), then update the MarkdownContent component to
replace [&_img]:max-h-[400px] and [&_img]:max-w-[min(100%,400px)] with
[&_img]:max-h-markdown-img and [&_img]:max-w-markdown-img respectively so the
component uses project design tokens instead of arbitrary Tailwind values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/common/ui/editor/markdown-content.tsx`:
- Line 245: The Tailwind arbitrary values in the MarkdownContent image class
string (the array entry containing '[&_img]:rounded-100
[&_img]:border-border-subtle [&_img]:mb-100 [&_img]:block [&_img]:h-auto
[&_img]:max-h-[400px] [&_img]:max-w-[min(100%,400px)] [&_img]:border
[&_img]:object-contain') violate the coding guideline; add two custom utility
classes in global.css (e.g., .max-h-markdown-img and .max-w-markdown-img) that
implement max-height: 400px and max-width: min(100%,400px), then update the
MarkdownContent component to replace [&_img]:max-h-[400px] and
[&_img]:max-w-[min(100%,400px)] with [&_img]:max-h-markdown-img and
[&_img]:max-w-markdown-img respectively so the component uses project design
tokens instead of arbitrary Tailwind values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2eb3d1f0-83cd-4e02-a057-55eeb15ba2cd

📥 Commits

Reviewing files that changed from the base of the PR and between eac199f and fcecc08.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • .eslintrc.cjs
  • .husky/pre-commit
  • next.config.ts
  • src/components/common/ui/editor/markdown-content.tsx
  • src/components/one-on-one/one-on-one-page.tsx
  • src/features/mentoring/ui/registration/markdown/mentor-markdown-rendering.ts
  • src/types/css.d.ts
  • tsconfig.json
💤 Files with no reviewable changes (2)
  • .husky/pre-commit
  • src/components/one-on-one/one-on-one-page.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/types/css.d.ts

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