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

Feature: 세션 수정 시 출석 정보가 없을 때 처리 #119

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package org.cotato.csquiz.api.session.dto;

import static org.cotato.csquiz.domain.attendance.enums.DeadLine.DEFAULT_ATTENDANCE_DEADLINE;
import static org.cotato.csquiz.domain.attendance.enums.DeadLine.DEFAULT_LATE_DEADLINE;

import java.time.LocalDate;
import java.util.Objects;
import org.cotato.csquiz.api.attendance.dto.AttendanceDeadLineDto;
import org.cotato.csquiz.domain.attendance.embedded.Location;
import org.cotato.csquiz.domain.generation.enums.CSEducation;
Expand Down Expand Up @@ -28,4 +32,10 @@ public record UpdateSessionRequest(
@NotNull
DevTalk devTalk
) {
public UpdateSessionRequest {
if (Objects.isNull(attendTime)) {
attendTime = new AttendanceDeadLineDto(DEFAULT_ATTENDANCE_DEADLINE.getTime(),
DEFAULT_LATE_DEADLINE.getTime());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public void updateSessionDate(Session session, LocalDate newDate, AttendanceDead
Attendance findAttendance = attendanceRepository.findBySessionId(session.getId())
.orElseThrow(() -> new EntityNotFoundException("해당 세션의 출석이 존재하지 않습니다"));


// 날짜가 바뀌지 않았고, 출결 시간이 모두 동일한 경우
if (newDate.equals(session.getSessionDate()) &&
findAttendance.getAttendanceDeadLine().toLocalTime().equals(newDeadline.attendanceDeadLine()) &&
Expand All @@ -140,7 +141,7 @@ public void updateSessionDate(Session session, LocalDate newDate, AttendanceDead
session.updateSessionDate(newDate);

LocalDateTime newAttendanceDeadline = LocalDateTime.of(newDate, newDeadline.attendanceDeadLine());
LocalDateTime newLateDeadline = LocalDateTime.of(newDate, newDeadline.attendanceDeadLine());
LocalDateTime newLateDeadline = LocalDateTime.of(newDate, newDeadline.lateDeadLine());
findAttendance.updateDeadLine(newAttendanceDeadline, newLateDeadline);

attendanceRecordService.updateAttendanceStatus(findAttendance);
Expand Down
Loading