Skip to content

Commit 3e94ac0

Browse files
authored
fix : 진행중인 문제 수정 안되는 이슈 (#380)
1 parent 2d2c7cb commit 3e94ac0

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

src/main/java/com/gamzabat/algohub/feature/problem/service/ProblemService.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ private void checkProblemValidation(Problem problem) {
128128
throw new ProblemValidationException(HttpStatus.FORBIDDEN.value(),
129129
"문제 수정이 불가합니다. : 이미 종료된 문제입니다.");
130130
}
131-
if (problem.getStartDate().isBefore(LocalDate.now()) || problem.getStartDate().equals(LocalDate.now())) {
132-
throw new ProblemValidationException(HttpStatus.FORBIDDEN.value(),
133-
"문제 수정이 불가합니다. : 이미 진행 중인 문제입니다.");
134-
}
135-
136131
}
137132

138133
private void checkProblemEndDate(EditProblemRequest request, Problem problem) {

src/test/java/com/gamzabat/algohub/service/ProblemServiceTest.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -358,30 +358,6 @@ void editProblemFailed_4() {
358358
.hasFieldOrPropertyWithValue("error", "문제 수정 권한이 없습니다. 방장, 부방장일 경우에만 수정이 가능합니다.");
359359
}
360360

361-
@Test
362-
@DisplayName("문제 정보 수정 실패 : 이미 진행 중인 문제인데 시작날짜 수정을 요청하는 경우")
363-
void editProblemFailed_5() {
364-
// given
365-
Problem problem = Problem.builder()
366-
.studyGroup(group)
367-
.link("link")
368-
.startDate(LocalDate.now().minusDays(1))
369-
.endDate(LocalDate.now().plusDays(10))
370-
.build();
371-
EditProblemRequest request = EditProblemRequest.builder()
372-
.startDate(LocalDate.now().plusDays(1))
373-
.endDate(LocalDate.now().plusDays(7))
374-
.build();
375-
when(problemRepository.findById(20L)).thenReturn(Optional.ofNullable(problem));
376-
when(groupRepository.findById(10L)).thenReturn(Optional.ofNullable(group));
377-
when(groupMemberRepository.findByUserAndStudyGroup(user, group)).thenReturn(Optional.ofNullable(groupMember1));
378-
// when, then
379-
assertThatThrownBy(() -> problemService.editProblem(user, 20L, request))
380-
.isInstanceOf(ProblemValidationException.class)
381-
.hasFieldOrPropertyWithValue("code", HttpStatus.FORBIDDEN.value())
382-
.hasFieldOrPropertyWithValue("error", "문제 수정이 불가합니다. : 이미 진행 중인 문제입니다.");
383-
}
384-
385361
@Test
386362
@DisplayName("문제 정보 수정 실패 : 문제 시작 날짜를 오늘 이전의 날짜로 요청한 경우")
387363
void editProblemFailed_6() {

0 commit comments

Comments
 (0)