Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
giwoong01 committed Sep 27, 2023
1 parent d7b8797 commit b77a929
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,15 @@ public MemberRankResDto memberRakingInformation(Long memberId, int departmentNum

Member member = memberRepository.findById(memberId).orElseThrow(NotFoundMemberException::new);

if (member.getDepartment().equals(ChangeDepartment.departmentNumber(departmentNumber))) {
return new MemberRankResDto(member.getMemberId(),
member.getTier(),
member.getScore(),
member.getNickname(),
member.getDepartment(),
myDepartmentRanking(departmentNumber, member.getScore()));
} else {
return new MemberRankResDto(member.getMemberId(),
member.getTier(),
member.getScore(),
member.getNickname(),
member.getDepartment(),
myRanking(member.getScore()));
}
int myRanking = member.getDepartment().equals(ChangeDepartment.departmentNumber(departmentNumber)) ?
myDepartmentRanking(departmentNumber, member.getScore()) : myRanking(member.getScore());

return new MemberRankResDto(member.getMemberId(),
member.getTier(),
member.getScore(),
member.getNickname(),
member.getDepartment(),
myRanking);
}

/**
Expand Down

0 comments on commit b77a929

Please sign in to comment.