Skip to content

Commit

Permalink
refactor: 우수 스터디원 선정 내역 기본값을 리스트로 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
kckc0608 committed Oct 9, 2024
1 parent d56b660 commit d998be5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.gdschongik.gdsc.infra.github.client.GithubClient;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -126,7 +127,8 @@ public List<StudentMyCompleteStudyResponse> getMyCompletedStudies() {

return studyHistories.stream()
.map(history -> {
List<AchievementType> achievementTypes = achievementsByStudy.get(history.getStudy());
List<AchievementType> achievementTypes =
achievementsByStudy.getOrDefault(history.getStudy(), new ArrayList<>());
return StudentMyCompleteStudyResponse.of(history, achievementTypes);
})
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.gdschongik.gdsc.domain.study.domain.StudyHistory;
import com.gdschongik.gdsc.domain.study.domain.StudyHistoryStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import java.util.List;

public record StudentMyCompleteStudyResponse(
Expand All @@ -19,7 +18,7 @@ public record StudentMyCompleteStudyResponse(
@Schema(description = "멘토 이름") String mentorName,
@Schema(description = "총 주차수") Long totalWeek,
@Schema(description = "수료 여부") StudyHistoryStatus studyHistoryStatus,
@Nullable @Schema(description = "우수 스터디원 여부") List<AchievementType> achievements) {
@Schema(description = "우수 스터디원 여부") List<AchievementType> achievements) {

public static StudentMyCompleteStudyResponse of(StudyHistory studyHistory, List<AchievementType> achievements) {
return new StudentMyCompleteStudyResponse(
Expand Down

0 comments on commit d998be5

Please sign in to comment.