-
Notifications
You must be signed in to change notification settings - Fork 1
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/#60 출석 관련 세부 로직 추가 #62
Conversation
public static ChallengeLevelType findByLevel(int level) { | ||
return Arrays.stream(values()) | ||
.filter(t -> t.level == level) | ||
.findFirst() | ||
.orElse(LEVEL_FIVE); |
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.
네이밍 get(int level) 어떤가요?!
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.
네이밍 get(int level) 어떤가요?!
get은 Getter메서드 느낌이 강해서 find 는 어떠신가요?
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.
좋아용~
public void checkAttendance(Article article, Member member) { | ||
if (checkIsNotAttended(member)) { | ||
if (checkIsTodayArticle(article, member)) { | ||
attendanceRepository.save(Attendance.newInstance(member)); | ||
|
||
int attendanceCheckCount = attendanceRepository.findAttendancesByMember(member).size(); | ||
member.getChallenge().levelUp(attendanceCheckCount); | ||
} | ||
} | ||
} | ||
|
||
private boolean notAttended(Member member) { | ||
Optional<Attendance> firstMemberAttendance = findMemberLastAttendance(member); | ||
if (firstMemberAttendance.isEmpty()) { | ||
private boolean checkIsTodayArticle(Article article, Member member) { | ||
WeekAndDay weekAndDay = MemberServiceUtils.findMemberWeekAndDay(member); | ||
|
||
return weekAndDay.equals(WeekAndDay.of(article.getWeek(), article.getDay())); | ||
} |
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.
boolean 메서드는 is 로 시작하는거 어떤가요?!
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.
boolean 메서드는 is 로 시작하는거 어떤가요?!
isPresent() 예시를 듣고 인정하였읍니다
return DateUtils.getDayDifference(LocalDateTime.now(), firstMemberAttendance.get().getCreatedAt()) != 0; | ||
boolean isNotAttended = | ||
DateUtils.getDayDifference(LocalDateTime.now(), memberLatestAttendance.get().getCreatedAt()) != ZERO; | ||
|
||
return isNotAttended; |
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.
여기 바로 return 하는거 의견 제시해봅니당..
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.
여기 바로 return 하는거 의견 제시해봅니당..
넵! 뭔가 필요없이 코드라인이 낭비되는 느낌이 드네요..!
✒️ 관련 이슈번호
🔑 Key Changes
📢 To Reviewers