Skip to content

Commit

Permalink
chore (#3) : studyDegree 정도에 맞게 시간 부여되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
daehwan2yo committed Apr 10, 2022
1 parent 7adba6b commit ff1a16d
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,29 @@ private List<Exam> extractExams(Account account, CreateCalendarRequest createCal
.map(dto -> Exam.builder()
.dueDateTime(dto.getDate())
.name(dto.getName())
.studyDegree(dto.getPrepareTime())
.studyDegree(extractStudyDegree(dto))
.account(account)
.build())
.collect(Collectors.toList());
}

private int extractStudyDegree(CreateCalendarRequest.ExamInfo dto) {
switch (dto.getPrepareTime()) {
case 1:
return 10;
case 2:
return 20;
case 3:
return 30;
case 4:
return 40;
case 5:
return 50;
default:
throw new IllegalArgumentException("studyDegree accept only 1~5");
}
}

@GetMapping(value = "/my/calendar/result", produces = APPLICATION_JSON_VALUE)
public ResponseEntity<CalendarResponse> getMyCalenderResponse(@LoginAccount Account account) {
Calendar calendar = calendarService.find(account);
Expand Down

0 comments on commit ff1a16d

Please sign in to comment.