Skip to content

[UNI-100] refactor : 코어 루트 삭제에 따른 조회 로직 수정#36

Merged
thdgustjd1 merged 4 commits intobefrom
feat/UNI-100
Feb 4, 2025
Merged

[UNI-100] refactor : 코어 루트 삭제에 따른 조회 로직 수정#36
thdgustjd1 merged 4 commits intobefrom
feat/UNI-100

Conversation

@thdgustjd1
Copy link
Copy Markdown
Collaborator

📝 PR 타입

  • 기능 구현
  • 기능 수정
  • 버그 수정
  • 리팩토링
  • 인프라, 의존성, 환경 변수, 빌드 관련 코드 업데이트

🚀 변경 사항

코어 루트가 삭제되어 대학교의 모든 route를 조회하는 로직을 수정하였습니다.

  • 코어노드 간에는 BFS로 이동하였으며, 코어노드와 코어노드 사이에 존재하는 서브노드들 (기존의 코어 루트)을 선형으로 탐색하여 List에 담아 처리하였습니다.
  • 사이클, route 미존재, 코어노드가 없는 경우 등 예외처리를 진행하였습니다.

💡 To Reviewer

  • 로직 특성상 코드가 길고 사용하는 변수가 많아서 읽기 어려울 것으로 예상됩니다. 최대한 주석을 달았지만, 이해되지 않는 부분 있으면 코멘트나 오프라인으로 질문해주시면 감사하겠습니다.
  • BFS 로직 안에 존재하는 이중 while문을 분리하고 싶었으나 그렇게 될 경우 7,8개의 파라미터를 넘겨줘야 하는 상황입니다. 좋은 코드 수정 방향 있으면 조언 부탁드립니다.
  • 현재 lat, lng가 반대로 출력되는것 같은데 같은 현상 겪고 계신지 확인 부탁드립니다.

🧪 테스트 결과

<<테스트 결과>>
image

<<코어노드가 없는 (일자로 된 경우) 지도에서의 예외처리 테스트>>
image

✅ 반영 브랜치

@thdgustjd1 thdgustjd1 added 🚀 feat 기능 개발 💡 refactor 기능 개선 🫀 be 백엔드 task labels Feb 3, 2025
@thdgustjd1 thdgustjd1 requested a review from mikekks February 3, 2025 09:57
@thdgustjd1 thdgustjd1 self-assigned this Feb 3, 2025
@softeer5th softeer5th deleted a comment from coderabbitai bot Feb 3, 2025
Copy link
Copy Markdown
Collaborator

@mikekks mikekks left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 일단 리뷰남긴 곳 제외하고는 이해는 했는데 들여쓰기로 계속 되니 확실히 depth 가 좀 깊긴 하네요,, 이 부분 고민해보겠습니다!

Comment on lines +54 to +67
List<Long> endNodes = adjMap.entrySet()
.stream()
.filter(entry -> entry.getValue().size() == 1) // 리스트 크기가 1인 항목 필터링
.map(Map.Entry::getKey)
.collect(Collectors.toList());

//끝 노드가 2개인 경우 둘 중 하나에서 출발
if(endNodes.size()==2){
startNode = nodeMap.get(endNodes.get(0));
return List.of(getSingleRoutes(adjMap, startNode));
}

// 그 외의 경우의 수는 모두 사이클만 존재하거나, 규칙에 어긋난 맵
throw new InvalidMapException("Invalid Map", ErrorCode.INVALID_MAP);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

오프라인으로 얘기해보면 좋을 것 같습니다!!

Comment on lines +99 to +102
// 코어루트를 이루는 node들을 List로 저장
List<RouteCoordinatesInfo> coreRoute = new ArrayList<>();
coreRoute.add(RouteCoordinatesInfo.of(r.getId(),now.getId(), now.getXY(),currentNode.getId(),currentNode.getXY()));
routeSet.add(r.getId());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

코어 노드 및 코어노드와 붙어있는 노드 넣는 작업인가요??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

맞습니다! BFS과정 중 dequeue 한 뒤, 인접한 다음 코어노드까지 가는 길에 있는 모든 서브노드를 coreRoute로 묶는 과정입니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 4, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 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 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🫀 be 백엔드 task 🚀 feat 기능 개발 💡 refactor 기능 개선

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants