Skip to content

Conversation

@geniusYoo
Copy link
Contributor

Related issue 🛠

Work Description ✏️

솝트로그 아이콘을 정렬했습니다.
정렬 기준이 바뀔 경우를 대비해 정규 표현식을 사용해 정렬했습니다.

List<String> iconPriority = List.of("sop-level", "poke", "soptamp", "duration");
icons.sort(Comparator.comparingInt(s -> {
String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", "");
return iconPriority.indexOf(iconName);
}));

Trouble Shooting ⚽️

Related ScreenShot 📷

Uncompleted Tasks 😅

To Reviewers 📢

@geniusYoo geniusYoo added the 🛠️ BugFix 버그 해결 label Mar 27, 2025
@geniusYoo geniusYoo self-assigned this Mar 27, 2025
@height
Copy link

height bot commented Mar 27, 2025

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

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 the ordering of Sopt log icons by introducing a configurable S3 base URL and sorting the icons using a priority list with regex-based extraction of the icon name.

  • Introduces a new configuration property for the S3 base URL.
  • Implements icon sorting based on a defined priority list using regex for extraction.

List<String> icons = authFacade.getIcons(isActive ? IconType.ACTIVE : IconType.INACTIVE);
List<String> iconPriority = List.of("sop-level", "poke", "soptamp", "duration");
icons.sort(Comparator.comparingInt(s -> {
String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", "");
Copy link

Copilot AI Mar 27, 2025

Choose a reason for hiding this comment

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

The regex may not correctly match the literal ".png" extension since the period is unescaped. Consider using "\.png$" to ensure the period is treated as a literal dot.

Suggested change
String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", "");
String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|\\.png$", "");

Copilot uses AI. Check for mistakes.
List<String> iconPriority = List.of("sop-level", "poke", "soptamp", "duration");
icons.sort(Comparator.comparingInt(s -> {
String iconName = s.replaceAll("^" + s3BaseUrl + "sopt-log/|.png$", "");
return iconPriority.indexOf(iconName);
Copy link

Copilot AI Mar 27, 2025

Choose a reason for hiding this comment

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

If iconPriority.indexOf(iconName) returns -1 for icons not listed in iconPriority, it could lead to unintended sorting behavior. Consider handling cases where iconName is not found explicitly.

Suggested change
return iconPriority.indexOf(iconName);
int index = iconPriority.indexOf(iconName);
return index == -1 ? Integer.MAX_VALUE : index;

Copilot uses AI. Check for mistakes.
@geniusYoo geniusYoo merged commit 8da06b1 into dev Mar 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] 솝트로그 아이콘 정렬 추가

1 participant