-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 결과 페이지 - 상단 취향 요약 섹션, 하단 투표 결과 선호 카테고리 노출 순서 로직 수정 #117
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f637b2f
chore: add .worktrees to gitignore
youngminss 394d99d
Merge branch 'develop' of https://github.com/Nexters/hereeat into dev…
youngminss ced1a95
Merge branch 'develop' of https://github.com/Nexters/hereeat into dev…
youngminss 5ebf403
Merge branch 'develop' of https://github.com/Nexters/hereeat into dev…
youngminss 8a863d8
fix: 투표 결과 - 취향 조합 요약 로직 및 노출 순서 수정
youngminss facc6e0
fix: 투표 결과 - 선호 투표 수 기준으로 bar, dot 노출 순서 로직 수정
youngminss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,19 +216,27 @@ const PreferenceVoteBlock = ({ | |
| ? [unanimousCategory] | ||
| : voted.filter((c) => c !== CATEGORY.ANY); | ||
|
|
||
| // progress bar 세그먼트 (노출 순서 기준, votes 있는 것만) | ||
| const barCategories = foodCategoryOrder.filter( | ||
| (c) => (preferences[c] ?? 0) >= 1, | ||
| ); | ||
| // progress bar 세그먼트 (투표 수 내림차순, ANY 마지막, 동률은 고정 순서 유지) | ||
| const barCategories = foodCategoryOrder | ||
| .filter((c) => (preferences[c] ?? 0) >= 1) | ||
| .sort((a, b) => { | ||
| if (a === CATEGORY.ANY) return 1; | ||
| if (b === CATEGORY.ANY) return -1; | ||
| return (preferences[b] ?? 0) - (preferences[a] ?? 0); | ||
| }); | ||
| const totalVotes = barCategories.reduce( | ||
| (sum, c) => sum + (preferences[c] ?? 0), | ||
| 0, | ||
| ); | ||
|
|
||
| // 카테고리 dot 목록 (ANY 포함, 순서 유지, count > 0만) | ||
| const listCategories = foodCategoryOrder.filter( | ||
| (c) => (preferences[c] ?? 0) >= 1, | ||
| ); | ||
| // 카테고리 dot 목록 (투표 수 내림차순, ANY 마지막, 동률은 고정 순서 유지) | ||
| const listCategories = foodCategoryOrder | ||
| .filter((c) => (preferences[c] ?? 0) >= 1) | ||
| .sort((a, b) => { | ||
| if (a === CATEGORY.ANY) return 1; | ||
| if (b === CATEGORY.ANY) return -1; | ||
| return (preferences[b] ?? 0) - (preferences[a] ?? 0); | ||
| }); | ||
|
Comment on lines
+219
to
+239
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
References
|
||
|
|
||
| return ( | ||
| <div className="ygi:flex ygi:flex-col ygi:gap-4 ygi:rounded-md ygi:bg-surface-white ygi:p-5"> | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
조건문
!isAllAnyPreferences는 중복 확인으로 보입니다.isAllAnyPreferences가votedPreferencesWithoutAny.length === 0으로 정의되어 있으므로,else if블록에 도달했다는 것은 이미votedPreferencesWithoutAny.length가 0이 아니라는 의미를 내포합니다. 따라서 해당 조건을 제거하여 코드를 더 간결하게 만들 수 있습니다.