diff --git a/README.md b/README.md index 16405c9..73eb296 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# depromeet-makers-be \ No newline at end of file +# depromeet-makers-be diff --git a/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt b/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt index bef4182..e85f9cc 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt @@ -36,13 +36,19 @@ class GetMemberAttendances( ) } - val attendances = (1..16).map { - attendanceGateway.save( + val attendances = (1..16).map { week -> + runCatching { + attendanceGateway.findByMemberIdAndGenerationAndWeek( + memberId = member.memberId, + generation = input.generation, + week = week + ) + }.getOrDefault( Attendance.newAttendance( member = member, generation = input.generation, - week = it, - sessionType = sessions[it - 1].sessionType, + week = week, + sessionType = sessions[week - 1].sessionType, ) ) }