Skip to content

hotfix: 학과코드 없는 곳 대응 #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

gyumong
Copy link
Owner

@gyumong gyumong commented Feb 25, 2025

Summary by CodeRabbit

  • Bug Fixes

    • 졸업 진행 화면과 학생 정보 처리에서, 전공 명칭이 누락되었을 경우 대체 정보(학과 명칭)를 제공하도록 개선되어 표시 오류를 방지했습니다.
    • 데이터 처리 중 발생할 수 있는 일부 오류 상황을 완화하여 사용자 경험을 향상시켰습니다.
  • Refactor

    • 학생 포털 연결 및 학업 정보 조회 절차를 재구성하여, 누락된 전공 정보에도 안정적으로 데이터를 처리할 수 있도록 로직을 개선했습니다.

Copy link

vercel bot commented Feb 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chukchuk-haksa ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 8:33am

Copy link
Contributor

coderabbitai bot commented Feb 25, 2025

Walkthrough

이 PR은 프론트엔드와 백엔드 코드의 안정성을 높이기 위한 변경 사항을 포함합니다. 프론트엔드에서는 handleGraduationProgressGraduationRequirementCard 컴포넌트에서 majorName이 없을 경우 departmentName으로 대체하는 조건 로직을 도입했습니다. 백엔드에서는 포털 연결 초기화 과정에서 부서와 전공 데이터를 순차적으로 조회하며, 전공 정보가 없을 경우 majorIdnull로 처리하도록 변경되었습니다. 또한, 관련 데이터 타입 수정과 에러 로깅 개선이 이루어졌습니다.

Changes

변경된 파일 변경 내용 요약
app/…/page.tsx handleGraduationProgressGraduationRequirementCard에서 majorName이 없으면 departmentName을 사용하도록 조건문 추가
server/application/…/UseCase.ts 부서 데이터를 먼저 조회하고, 전공 코드가 있을 경우 순차적으로 전공 데이터를 요청하여, 전공 정보 부재 시 majorIdnull로 설정하도록 변경
server/domain/…/IStudentRepository.ts StudentInitializationDataTypemajorId 타입을 number에서 `number
server/infrastructure/…/SupabaseUserRepository.ts findById의 쿼리 문자열 포맷을 가독성 있게 수정하고, initializePortalConnection에서 에러 발생 시 에러 로깅을 추가하여 디버깅 용이성 강화

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UseCase as InitializePortalConnectionUseCase
    participant Dept as Department Service
    participant Major as Major Service

    Client->>UseCase: 포털 연결 초기화 요청
    UseCase->>Dept: 부서 데이터 요청
    Dept-->>UseCase: 부서 데이터 반환
    UseCase->>UseCase: 전공 코드 존재 여부 확인
    alt 전공 정보가 있는 경우
        UseCase->>Major: 전공 데이터 요청
        Major-->>UseCase: 전공 데이터 반환
    else 전공 정보 없음
        UseCase->>UseCase: 전공 데이터를 null로 설정
    end
    UseCase->>Client: 학생 정보 반환
Loading

Poem

나는 코드를 뛰노는 작은 토끼, 🐰
major와 department 사이를 누비며
조건문 속 숨은 길을 발견했네
에러도 로깅해 밝은 길 만들고
코드 숲 속을 즐겁게 달리는 희망의 발자국! ✨

✨ 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 or @횟초리 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @일해라노예야 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.

Copy link
Contributor

@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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9f7c31a and f47c1a9.

📒 Files selected for processing (4)
  • app/(main)/main/page.tsx (2 hunks)
  • server/application/student/usecases/InitializePortalConnectionUseCase.ts (5 hunks)
  • server/domain/student/repository/IStudentRepository.ts (1 hunks)
  • server/infrastructure/supabase/repository/SupabaseUserRepository.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
app/(main)/main/page.tsx

[error] 27-27: Use Number.parseInt instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.

(lint/style/useNumberNamespace)

server/application/student/usecases/InitializePortalConnectionUseCase.ts

[error] 60-60: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (9)
server/domain/student/repository/IStudentRepository.ts (1)

25-25: 타입 확장을 통한 예외 상황 대응

인터페이스에서 majorId 타입을 number | null로 변경함으로써 학과 코드가 없는 경우에도 대응할 수 있게 되었습니다. 이 변경은 전공 정보가 없는 학생 데이터를 처리할 때 발생할 수 있는 런타임 오류를 방지합니다.

server/infrastructure/supabase/repository/SupabaseUserRepository.ts (2)

14-16: 가독성이 향상된 코드 구조

select 문을 여러 줄로 분리하여 가독성이 향상되었습니다. 기능적 변화는 없지만 코드 유지 관리 측면에서 좋은 변경입니다.


41-41: 에러 로깅 추가로 디버깅 개선

에러 발생 시 로그를 남기는 코드를 추가하여 디버깅이 용이해졌습니다. 이는 포털 연동 초기화 과정에서 오류가 발생했을 때 원인 파악에 도움이 됩니다.

app/(main)/main/page.tsx (1)

55-55: 학과명 대체 로직 일관성 유지

majorName이 없을 경우 departmentName으로 대체하는 조건부 로직을 추가하여 handleGraduationProgress 함수의 로직과 일관성을 유지하고 있습니다. 이를 통해 누락된 데이터가 있는 상황에서도 UI가 적절히 렌더링됩니다.

server/application/student/usecases/InitializePortalConnectionUseCase.ts (5)

57-69: 단계적 데이터 조회로 오류 처리 개선

기존 병렬 처리 방식에서 순차적 처리 방식으로 변경하여 학과와 전공 데이터를 조회합니다. 특히 전공 코드가 없는 경우 null로 처리하는 로직 추가로 데이터 무결성이 향상되었습니다.

🧰 Tools
🪛 Biome (1.9.4)

[error] 60-60: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


79-79: 안전한 속성 접근으로 런타임 오류 방지

옵셔널 체이닝 연산자(?.)를 사용하여 major 객체가 null일 경우에도 안전하게 getId() 메서드에 접근할 수 있도록 수정했습니다. 이로써 전공 정보가 없는 경우에도 에러 없이 실행됩니다.


143-146: 조건 검증 로직 완화로 유연성 향상

majorId에 대한 유효성 검사를 제거하여 전공 정보가 없는 경우에도 처리할 수 있도록 변경했습니다. 이제 departmentId만 필수로 검증하므로 전공 정보가 없는 학과의 경우에도 포털 연동이 가능합니다.


152-152: 명시적 null 처리로 타입 안정성 확보

majorId가 없을 경우 명시적으로 null로 설정함으로써 타입 안정성을 확보했습니다. 이는 StudentInitializationDataType 인터페이스의 변경과 일치하며, 전공 정보가 없는 경우에도 일관된 데이터 구조를 유지합니다.


169-169: 대체 정보 제공으로 사용자 경험 개선

전공 정보(major)가 없을 경우 학과명(department.getName())을 대체로 사용하도록 변경했습니다. 이로써 전공 정보가 없는 학생도 일관된 정보를 제공받을 수 있어 사용자 경험이 개선됩니다.

@@ -24,7 +24,7 @@ export default function Home() {

const handleGraduationProgress = () => {
router.push(
`${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile.majorName}`
`${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

학과명 대체 로직 개선 및 ES2015 표준 준수

majorName이 없을 경우 departmentName으로 대체하는 조건부 로직을 추가하여 누락된 데이터에 대한 대응이 개선되었습니다. 하지만 parseInt 대신 ES2015 표준인 Number.parseInt를 사용하는 것이 권장됩니다.

-      `${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
+      `${ROUTES.GRADUATION_PROGRESS}/${Number.parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`${ROUTES.GRADUATION_PROGRESS}/${parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
`${ROUTES.GRADUATION_PROGRESS}/${Number.parseInt(data?.profile.studentCode.slice(0, 2) ?? '0')}/${data?.profile?.majorName ? data?.profile?.majorName : (data?.profile?.departmentName ?? '')}`
🧰 Tools
🪛 Biome (1.9.4)

[error] 27-27: Use Number.parseInt instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.

(lint/style/useNumberNamespace)

@gyumong gyumong merged commit 4cb5165 into main Feb 25, 2025
4 checks passed
@gyumong gyumong deleted the hotfix/학과코드-없는-과-대응 branch February 25, 2025 08:35
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