From dca3eda1469e2f5890e53fd9a42580664f449da9 Mon Sep 17 00:00:00 2001 From: dragontaek-lee Date: Fri, 16 Feb 2024 00:39:00 +0900 Subject: [PATCH] =?UTF-8?q?[REFACTOR]=20=EC=B6=9C=EC=84=9D=20=EC=A4=91=20?= =?UTF-8?q?=EA=B2=B0=EC=84=9D=20=ED=8C=90=EB=B3=84=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/lecture/service/AppLectureServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java index ee895ffb..7f5fe825 100644 --- a/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java +++ b/operation-api/src/main/java/org/sopt/makers/operation/app/lecture/service/AppLectureServiceImpl.java @@ -73,6 +73,11 @@ private void checkAttendancesSize(List attendances) { } } + private boolean checkOnAttendanceAbsence(SubLecture subLecture, SubAttendance subAttendance) { + val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); + return isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT); + } + private Attendance getNowAttendance(List attendances) { val index = getAttendanceIndex(); return attendances.get(index); @@ -97,9 +102,8 @@ private String getMessage(Attribute attribute) { private TodayLectureResponse getTodayFirstLectureResponse(SubAttendance subAttendance, LectureResponseType responseType, Lecture lecture) { val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + if (checkOnAttendanceAbsence(subLecture, subAttendance)) { return TodayLectureResponse.of(responseType, lecture, message, Collections.emptyList()); } return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendance)); @@ -112,9 +116,8 @@ private TodayLectureResponse getTodaySecondLectureResponse( ) { val subAttendance = subAttendances.get(1); val subLecture = subAttendance.getSubLecture(); - val isOnAttendanceCheck = LocalDateTime.now().isBefore(subLecture.getStartAt().plusMinutes(10)); val message = getMessage(lecture.getAttribute()); - if (isOnAttendanceCheck && subAttendance.getStatus().equals(ABSENT)) { + if (checkOnAttendanceAbsence(subLecture, subAttendance)) { return TodayLectureResponse.of(responseType, lecture, message, Collections.singletonList(subAttendances.get(0))); } return TodayLectureResponse.of(responseType, lecture, message, subAttendances);