Skip to content

Comments

그룹스터디 필터링 로직 수정#379

Merged
HA-SEUNG-JEONG merged 3 commits intodevelopfrom
fix/study
Feb 5, 2026
Merged

그룹스터디 필터링 로직 수정#379
HA-SEUNG-JEONG merged 3 commits intodevelopfrom
fix/study

Conversation

@HA-SEUNG-JEONG
Copy link
Contributor

@HA-SEUNG-JEONG HA-SEUNG-JEONG commented Feb 5, 2026

🌱 연관된 이슈

☘️ 작업 내용

  • 리더 스터디 참여 체크박스 제거
  • 그룹 스터디 생성/수정 모달에서 멘토링 라디오 버튼 제거

🍀 참고사항

그룹 스터디 수정 시 기존 스터디 유형이 '멘토링' 인 경우 스터디 수정 모달에서 스터디 유형이 선택되지 않은 상태로 변경
image

스크린샷 (선택)

image

Summary by CodeRabbit

  • Bug Fixes

    • 그룹 스터디 설정에서 불필요한 리더 참여 여부 항목 제거
    • 분류 변경 시 멘토링이 허용되지 않는 경우(그룹 스터디) 기존 선택된 멘토링 유형이 자동으로 해제되도록 수정
  • New Features

    • 그룹 스터디로 분류하면 스터디 유형 목록에서 멘토링 옵션을 자동으로 숨김 (선택 불가)

@HA-SEUNG-JEONG HA-SEUNG-JEONG self-assigned this Feb 5, 2026
@vercel
Copy link

vercel bot commented Feb 5, 2026

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

Project Deployment Actions Updated (UTC)
study-platform-client-dev Ready Ready Preview, Comment Feb 5, 2026 2:40am

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

스터디 그룹 생성 흐름에서 리더 참여 여부 폼 필드를 제거하고, 분류가 GROUP_STUDY일 경우 스터디 타입 목록에서 MENTORING을 제외하도록 필터링 로직을 추가했습니다. 또한 form 값 보정 로직에서 분류·타입을 안전하게 재계산하도록 변경했습니다.

Changes

Cohort / File(s) Summary
스터디 생성 UI 변경
src/features/study/group/ui/step/step1-group.tsx
리더 참여 여부 관련 FormField 및 체크박스 제거, STUDY_TYPES를 분류에 따라 필터링해 MENTORING을 제외하는 로직 추가, 필터된 타입으로 UI 렌더링 변경
폼 값 보정 로직
src/features/study/group/ui/group-study-form-modal.tsx
refineStudyDetail에서 classification/type 값을 보정하도록 변경: 기본값 병합 및 GROUP_STUDY일 때 원래 타입이 MENTORING이면 type을 undefined로 처리
패키지 메타 변경
package.json
작은 라인 변경(추가/삭제) — 메타/스크립트 관련 소폭 수정 가능성(구체 변경 내용은 파일 확인 필요)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 깡충, 깡총 나는 토끼가 말하네
체크박스는 사라지고, 한 가지 타입만 빼네
분류 맞춰 깔끔히 정리했지요
작은 변경에도 기쁨 가득히
폼이 가벼워졌네, 햇살처럼 😊

🚥 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
Title check ✅ Passed PR 제목이 주요 변경 사항을 정확하게 요약하고 있습니다. '그룹스터디 필터링 로직 수정'은 멘토링 옵션 제거 및 조건부 스터디 타입 필터링 구현이라는 핵심 변경을 명확하게 나타냅니다.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/study

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

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 `@src/features/study/group/ui/step/step1-group.tsx`:
- Around line 61-65: When filtering out 'MENTORING' (shouldFilterMentoring /
filteredStudyTypes derived from STUDY_TYPES), ensure any existing selected type
equal to 'MENTORING' is replaced with a valid option: add logic (e.g., a
useEffect that runs when classification changes) that checks if
shouldFilterMentoring is true and the current selected type === 'MENTORING',
then set the selected type to a safe fallback such as filteredStudyTypes[0] (or
STUDY_TYPES.find(t => t !== 'MENTORING')). This guarantees the submitted value
is always valid when the mentoring option is hidden.

Comment on lines 61 to 65
const shouldFilterMentoring = classification === 'GROUP_STUDY';
const filteredStudyTypes = shouldFilterMentoring
? STUDY_TYPES.filter((type) => type !== 'MENTORING')
: STUDY_TYPES;

Copy link

@coderabbitai coderabbitai bot Feb 5, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

멘토링 필터링 시 기존 type 값 정합성 보장 필요

GROUP_STUDY로 전환되거나 편집 시 기존 값이 MENTORING이면 옵션이 숨겨진 채 값이 그대로 제출될 수 있습니다. 필터링될 때 유효하지 않은 값을 초기화/치환하세요.

✅ 제안 수정안
+import { useEffect } from 'react';
 import { addDays } from 'date-fns';
 ...
   const shouldFilterMentoring = classification === 'GROUP_STUDY';
   const filteredStudyTypes = shouldFilterMentoring
     ? STUDY_TYPES.filter((type) => type !== 'MENTORING')
     : STUDY_TYPES;
+
+  useEffect(() => {
+    if (shouldFilterMentoring && typeField.value === 'MENTORING') {
+      typeField.onChange(filteredStudyTypes[0] ?? undefined);
+    }
+  }, [shouldFilterMentoring, typeField.value, typeField.onChange, filteredStudyTypes]);
🤖 Prompt for AI Agents
In `@src/features/study/group/ui/step/step1-group.tsx` around lines 61 - 65, When
filtering out 'MENTORING' (shouldFilterMentoring / filteredStudyTypes derived
from STUDY_TYPES), ensure any existing selected type equal to 'MENTORING' is
replaced with a valid option: add logic (e.g., a useEffect that runs when
classification changes) that checks if shouldFilterMentoring is true and the
current selected type === 'MENTORING', then set the selected type to a safe
fallback such as filteredStudyTypes[0] (or STUDY_TYPES.find(t => t !==
'MENTORING')). This guarantees the submitted value is always valid when the
mentoring option is hidden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

굳이 useEffect를 써야 할 이유가 있어? 일단 그룹스터디 생성/수정 모달 호출 시 스터디 유형의 기본값은 '프로젝트'야.

Copy link

Choose a reason for hiding this comment

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

@HA-SEUNG-JEONG

좋은 지적이십니다. 기본값이 항상 '프로젝트'로 설정된다면 실제로 문제가 발생하지 않을 수 있습니다.

다만 한 가지 확인하고 싶은 점이 있습니다: 기존 스터디를 수정할 때도 동일한가요?

구체적으로:

  • 만약 이전에 classification이 다른 값(예: PREMIUM_STUDY)이었고 type이 'MENTORING'이었던 스터디가 있다면
  • 해당 스터디를 편집 모드로 열 때 classification이 'GROUP_STUDY'로 바뀐 상태라면
  • 이 경우에도 폼의 type 필드가 자동으로 '프로젝트'로 초기화되나요?

만약 편집 모드에서도 항상 '프로젝트'로 리셋되거나, 또는 MENTORING 스터디가 GROUP_STUDY classification으로는 편집되지 않는 구조라면 말씀하신 대로 useEffect는 불필요합니다. 이 부분만 확인해주시면 제안을 철회하겠습니다.


🧠 Learnings used
Learnt from: seong-jin-jo
Repo: code-zero-to-one/study-platform-client PR: 370
File: src/components/section/my-participating-studies-section.tsx:81-89
Timestamp: 2026-02-03T18:49:50.822Z
Learning: The component `src/components/section/my-participating-studies-section.tsx` is a temporary implementation that fetches all studies and filters them client-side against the user's participating study ID set. This approach is used due to the lack of a suitable backend API. The component should be refactored or potentially removed in the future when a proper backend API becomes available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그룹 스터디 생성 시에는 기본값 스터디 유형이 프로젝트고
그룹 스터디 수정 시에는 스터디 생성 시 선택했던 스터디 유형을 불러오는 구조야

Copy link

Choose a reason for hiding this comment

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

@HA-SEUNG-JEONG

명확한 설명 감사합니다! 구조를 이해했습니다.

마지막으로 한 가지만 확인하고 싶습니다:

데이터베이스에 이미 저장된 기존 그룹 스터디(classification='GROUP_STUDY') 중에서 type='MENTORING'으로 되어 있는 데이터가 존재할 가능성이 있나요?

만약 그런 데이터가 없다면(또는 있을 수 없는 구조라면), 말씀하신 대로 수정 시 불러오는 스터디 유형이 항상 유효한 옵션이므로 useEffect는 불필요합니다. 제안을 철회하겠습니다.

만약 그런 데이터가 존재할 수 있다면, 해당 데이터를 편집할 때 라디오 버튼 옵션에는 '멘토링'이 없지만 form 값은 'MENTORING'으로 남아있는 상태가 될 수 있습니다.


🧠 Learnings used
Learnt from: seong-jin-jo
Repo: code-zero-to-one/study-platform-client PR: 370
File: src/components/section/my-participating-studies-section.tsx:81-89
Timestamp: 2026-02-03T18:49:50.822Z
Learning: The component `src/components/section/my-participating-studies-section.tsx` is a temporary implementation that fetches all studies and filters them client-side against the user's participating study ID set. This approach is used due to the lack of a suitable backend API. The component should be refactored or potentially removed in the future when a proper backend API becomes available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

type='MENTORING'으로 되어 있는 데이터가 존재하고 있어

Copy link

Choose a reason for hiding this comment

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

@HA-SEUNG-JEONG

확인해주셔서 감사합니다! 그렇다면 제가 우려했던 문제가 실제로 발생할 수 있습니다.

문제 시나리오:

  1. DB에 classification='GROUP_STUDY'이면서 type='MENTORING'인 기존 스터디가 있음 (사용자님 확인)
  2. 해당 스터디를 수정 모드로 열면 form에 type='MENTORING' 값이 로드됨
  3. 하지만 현재 코드는 filteredStudyTypes에서 'MENTORING'을 제외하므로 라디오 버튼 목록에 '멘토링' 옵션이 렌더링되지 않음
  4. 결과: 어떤 라디오 버튼도 선택되지 않은 상태로 보이지만, 실제 form 값은 'MENTORING'으로 남아있어 데이터 정합성 문제 발생

따라서 원래 제안드린 useEffect를 통한 값 초기화 로직이 필요합니다.

혹시 useEffect를 사용하고 싶지 않으시다면 다음 대안도 가능합니다:

  • filteredStudyTypes를 계산한 직후에 현재 선택된 typeField.value가 필터링된 목록에 없으면 즉시 typeField.onChange(filteredStudyTypes[0])를 호출
  • 또는 form 초기화 시점에 validation/sanitization 로직 추가

어떤 방식을 선호하시나요?


✏️ Learnings added
Learnt from: HA-SEUNG-JEONG
Repo: code-zero-to-one/study-platform-client PR: 379
File: src/features/study/group/ui/step/step1-group.tsx:61-65
Timestamp: 2026-02-05T02:17:49.724Z
Learning: In the repository `code-zero-to-one/study-platform-client`, there are existing database records where `classification='GROUP_STUDY'` and `type='MENTORING'`. When editing such records in `src/features/study/group/ui/step/step1-group.tsx`, the form must handle the case where the loaded type value is filtered out from the available options.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: seong-jin-jo
Repo: code-zero-to-one/study-platform-client PR: 370
File: src/components/section/my-participating-studies-section.tsx:81-89
Timestamp: 2026-02-03T18:49:50.822Z
Learning: The component `src/components/section/my-participating-studies-section.tsx` is a temporary implementation that fetches all studies and filters them client-side against the user's participating study ID set. This approach is used due to the lack of a suitable backend API. The component should be refactored or potentially removed in the future when a proper backend API becomes available.

@code-zero-to-one code-zero-to-one deleted a comment from coderabbitai bot Feb 5, 2026
@HA-SEUNG-JEONG HA-SEUNG-JEONG merged commit 327ca4d into develop Feb 5, 2026
9 checks passed
@HA-SEUNG-JEONG HA-SEUNG-JEONG deleted the fix/study branch February 5, 2026 03:06
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