Skip to content
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

Feature/검색창 기수별 정렬순서 수정 #892 #898

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

oxomi
Copy link
Collaborator

@oxomi oxomi commented May 23, 2024

연관 이슈

작업 요약

  • '활동 회원 관리 페이지'와 '직책 관리 페이지'의 회원 검색창에 뜨는 회원 목록에서, 기수별 순서가 제대로 정렬되지 않고 1, 10, 11, 12 ... 3, 4, 5 순으로 보이는 문제가 발생하여 로직을 다시 구현.

작업 상세 설명

  • group(기수) 값을 float로 변환하여 sort 메서드를 활용해 오름차순으로 정렬하였습니다.
  • 기수가 동일할 경우 localeCompare 메서드를 활용해 알파벳순으로 정렬하였습니다.

리뷰 요구사항

리뷰 예상 시간 : 1분

Preview 이미지

@oxomi oxomi requested review from publdaze and redzzzi May 23, 2024 16:09
@oxomi oxomi self-assigned this May 23, 2024
@oxomi oxomi added the Feature 기능 추가 label May 23, 2024
@oxomi oxomi changed the title Feature/검색창_기수별_정렬순서_수정_#892 Feature/검색창 기수별 정렬순서 수정_#892 May 24, 2024
@oxomi oxomi changed the title Feature/검색창 기수별 정렬순서 수정_#892 Feature/검색창 기수별 정렬순서 수정 #892 May 24, 2024
Comment on lines 18 to 25
const sortedOptions = options.sort((a, b) => {
const aGroup = parseFloat(a.group);
const bGroup = parseFloat(b.group);
if (aGroup !== bGroup) {
return aGroup - bGroup;
}
return a.label.localeCompare(b.label);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const sortedOptions = options.sort((a, b) => {
const aGroup = parseFloat(a.group);
const bGroup = parseFloat(b.group);
if (aGroup !== bGroup) {
return aGroup - bGroup;
}
return a.label.localeCompare(b.label);
});
const sortedOptions = options.sort(
(a, b) => parseFloat(a.group) - parseFloat(b.group) || a.label.localeCompare(b.label),
);

단축 평가 활용하면 더 간결하게 작성 가능할 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

앗 넵 고쳐보겠습니당!

Comment on lines 32 to 39
const sortedOptions = options.sort((a, b) => {
const aGroup = parseFloat(a.group);
const bGroup = parseFloat(b.group);
if (aGroup !== bGroup) {
return aGroup - bGroup;
}
return a.label.localeCompare(b.label);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const sortedOptions = options.sort((a, b) => {
const aGroup = parseFloat(a.group);
const bGroup = parseFloat(b.group);
if (aGroup !== bGroup) {
return aGroup - bGroup;
}
return a.label.localeCompare(b.label);
});
const sortedOptions = options.sort(
(a, b) => parseFloat(a.group) - parseFloat(b.group) || a.label.localeCompare(b.label),
);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

늦어서 죄송합니다😅😅 수정 완료했습니다!

- 정렬 로직을 단축 평가를 활용하여 단순화 하였습니다.
@oxomi oxomi requested a review from publdaze June 3, 2024 08:20
Copy link
Contributor

@publdaze publdaze left a comment

Choose a reason for hiding this comment

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

👍 수고하셨습니다!

@oxomi oxomi merged commit bc6a96e into develop Jun 4, 2024
1 check passed
@oxomi oxomi deleted the feature/검색창_기수별_정렬순서_수정_#892 branch June 4, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants