Skip to content

[#386] 학과 정보 없을 때 MISSING_USER_DEPARTMENT 에러 방지#387

Open
Hrepay wants to merge 1 commit intodevelopfrom
fix/#386
Open

[#386] 학과 정보 없을 때 MISSING_USER_DEPARTMENT 에러 방지#387
Hrepay wants to merge 1 commit intodevelopfrom
fix/#386

Conversation

@Hrepay
Copy link
Member

@Hrepay Hrepay commented Feb 12, 2026

#️⃣ 관련 이슈

Resolved #386

💡작업 내용

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

  1. API 호출 전 검증 추가: fetchMyPartnerships()에서 학과 정보 없으면 API 호출 차단
  2. Realm 동기화: 서버 조회 실패 시 Realm 데이터도 함께 초기화하여 데이터 일관성 유지

💬리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

@Hrepay Hrepay requested a review from Copilot February 12, 2026 13:52
@Hrepay Hrepay self-assigned this Feb 12, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @Hrepay, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 사용자 학과 정보가 없을 때 발생할 수 있는 MISSING_USER_DEPARTMENT 에러를 방지하고, 서버와 로컬 데이터(Realm) 간의 데이터 일관성을 강화하는 것을 목표로 합니다. 학과 정보가 없는 경우 불필요한 API 호출을 막고, 서버에서 학과 정보를 가져오지 못했을 때 로컬 데이터도 함께 초기화하여 데이터 불일치 문제를 해결합니다.

Highlights

  • API 호출 전 검증 추가: fetchMyPartnerships() 메서드에서 학과 정보가 없을 경우 API 호출을 차단하여 서버 에러를 방지하는 로직이 추가되었습니다.
  • Realm 데이터 동기화: fetchMyDepartment() 호출 실패 시 Realm에 저장된 학과 정보도 함께 초기화하여 서버와 클라이언트 간의 데이터 일관성을 유지하도록 개선되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • EATSSU/App/Sources/Presentation/Map/ViewController/MainMapViewController+Network.swift
    • fetchMyDepartment 메서드에서 학과 조회 실패 시 Realm 사용자 정보의 학과 필드를 nil로 업데이트하는 로직이 추가되었습니다.
    • fetchMyPartnerships 메서드에 currentDepartmentName이 비어있거나 nil일 경우 API 호출을 건너뛰는 가드문이 추가되었습니다.
Activity
  • 현재까지 사람의 활동은 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


학과 없으면 API 호출 멈춰라 데이터 일관

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

이번 PR은 학과 정보가 없을 때 발생하는 서버 오류를 방지하고, 학과 정보 조회 실패 시 로컬 데이터(Realm)를 동기화하여 데이터 일관성을 유지하도록 수정한 점이 좋습니다. 추가적으로, 학과 정보 조회 성공 시에도 로컬 데이터를 업데이트하여 데이터 정합성을 더욱 높이는 방안을 제안했습니다.

Comment on lines 41 to 43
self.currentDepartmentName = departmentName
self.currentDepartmentId = department.departmentId
self.currentCollegeId = department.collegeId

Choose a reason for hiding this comment

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

medium

데이터 일관성을 위해, success 케이스에서도 조회된 학과 정보로 Realm DB를 업데이트하는 것이 좋습니다.

Suggested change
self.currentDepartmentName = departmentName
self.currentDepartmentId = department.departmentId
self.currentCollegeId = department.collegeId
self.currentDepartmentName = departmentName
self.currentDepartmentId = department.departmentId
self.currentCollegeId = department.collegeId
// 로컬 DB와 동기화
if let userInfo = UserInfoManager.shared.getCurrentUserInfo() {
UserInfoManager.shared.updateDepartment(
for: userInfo,
collegeId: department.collegeId,
collegeName: department.collegeName,
departmentId: department.departmentId,
departmentName: departmentName
)
}

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where the app would generate a MISSING_USER_DEPARTMENT error when attempting to fetch department-specific partnerships without department information. The fix adds preventive validation and improves data synchronization between server and local Realm storage.

Changes:

  • Added pre-API validation in fetchMyPartnerships() to prevent server calls when department information is missing
  • Added Realm data synchronization in fetchDepartmentAndUpdateButton() failure case to maintain consistency between server and local storage


case .failure(let error):
print("내 제휴 조회 실패: \(error.localizedDescription)")
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

The early return path clears markers by calling displayMarkers([]), but the failure case at line 89-90 does not clear markers. This creates inconsistent behavior: when department info is missing, markers are cleared, but when the API call fails for other reasons, old markers remain visible. Consider calling self?.displayMarkers([]) in the failure case for consistency, or clarify if the different behavior is intentional.

Suggested change
print("내 제휴 조회 실패: \(error.localizedDescription)")
print("내 제휴 조회 실패: \(error.localizedDescription)")
self?.displayMarkers([])

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 학과정보 2차 수정

1 participant