Skip to content

Commit

Permalink
chore: member ranks 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
songyi00 committed Aug 13, 2024
1 parent a9ca677 commit 8cf0f0c
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.nexters.goalpanzi.domain.mission;

import com.nexters.goalpanzi.domain.member.Member;
import lombok.RequiredArgsConstructor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;

@RequiredArgsConstructor
public class MemberRanks {

private final List<MemberRank> memberRanks;

private MemberRanks(final List<MemberRank> memberRanks) {
this.memberRanks = memberRanks;
}

public static MemberRanks from(final List<MissionMember> missionMembers) {
List<MissionMember> sortedMissionMembers = sortedMembersByVerificationCountDesc(missionMembers);

Expand All @@ -29,7 +32,7 @@ public static MemberRanks from(final List<MissionMember> missionMembers) {
previousVerificationCount = missionMember.getVerificationCount();
}

return new MemberRanks(memberRanks);
return new MemberRanks(Collections.unmodifiableList(memberRanks));
}

private static List<MissionMember> sortedMembersByVerificationCountDesc(final List<MissionMember> missionMembers) {
Expand Down

0 comments on commit 8cf0f0c

Please sign in to comment.