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

fix: 미션 인증 정렬 로직 #79

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

kimyu0218
Copy link
Collaborator

@kimyu0218 kimyu0218 commented Aug 28, 2024

Issue Number

close: #68

작업 개요

viewedAt이 추가되면서 viewedAtnull인 값들이 앞에 오게 되어 생긴 문제

작업 사항

viewedAtnull인 경우는 두 가지 경우가 있다.

  1. 인증하지 않은 경우
  2. 인증했지만 내가 확인하지 않은 경우

두 가지 경우 중 2번만 가장 앞에 와야 하는데 viewedAtnull인 경우가 모두 앞으로 오게 되면서 1번이 가장 앞에 오는 문제가 발생했다.

고민한 점들(필수 X)

private Comparator<MissionVerificationResponse> unviewedVerificationFirst() {
-     return Comparator.comparing(MissionVerificationResponse::viewedAt, Comparator.nullsFirst(Comparator.naturalOrder()));
+    return Comparator.comparing((MissionVerificationResponse response) -> {
+        if (response.verifiedAt() != null && response.viewedAt() == null) { // 1. 인증했지만 내가 확인하지 않은 겻이 가장 먼저
+            return 0;
+        }
+        if (response.verifiedAt() != null) { // 2. 인증했지만 내가 확인한 것이 그 이후
+            return 1;
+        }
+        return 2; // 3. 인증하지 않은 것이 마지막에
+    });
}

스크린샷(필수 X)

Copy link
Member

@songyi00 songyi00 left a comment

Choose a reason for hiding this comment

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

너무 늦게 확인했다ㅠㅠ
고생했어 유정 🤓

@kimyu0218 kimyu0218 merged commit f300dc8 into develop Sep 17, 2024
1 check passed
@kimyu0218 kimyu0218 deleted the fix/#68-mission-verification-view branch September 17, 2024 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

미션 인증 피드 확인 API
2 participants