[Hotfix]: 최다 찬성 정렬 로직 수정 #82
Closed
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.
변경사항
최다 찬성 시 [찬성-반대]가 큰 순서대로 정렬되도록 수정했습니다.
또한 득표 수가 0표인 아이디어는 하이라이트되지 못하도록 수정했습니다.
로직 요약
정렬 로직 (Sort)
1순위: [찬성 - 반대] 차이가 큰 순서 (득표 차)
2순위: 차이가 같다면 [찬성 수]가 더 많은 순서
결과: 여론이 가장 긍정적이고 참여도가 높은 항목이 상단에 배치됩니다.
상위 3등 기준 추출
리스트의 3번째 항목(index 2)을 기준으로 **기준 찬성수(thirdAgree)**와 **기준 차이값(thirdDiff)**을 뽑아냅니다.
필터링 (공동 순위 처리)
기본 포함: 일단 인덱스 상위 3개(0, 1, 2)는 무조건 포함합니다.
공동 순위 처리: 4위부터는 3위와 찬성 수가 같으면서, 득표 차이(diff)가 더 큰 경우 등을 체크하여 포함 여부를 결정합니다.