Skip to content

Commit

Permalink
fix: 완료된 할 일 desc -> ascr
Browse files Browse the repository at this point in the history
  • Loading branch information
pkl0912 committed Nov 1, 2024
1 parent 9075bec commit 2b75ba7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public TodayListResponseDto getTodayList(long userId, int page, int size, LocalD
todays.addAll(incompleteTodos);

// 완료된 할 일 조회
List<Todo> completedTodos = todoRepository.findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByCompletedDateTimeDesc(
List<Todo> completedTodos = todoRepository.findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByCompletedDateTimeAsc(
userId, Type.TODAY, todayDate, TodayStatus.COMPLETED);
todays.addAll(completedTodos);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface TodoRepository {
void deleteAllByUserId(Long userId);
List<Todo> findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByTodayOrderDesc(
Long userId, Type type, LocalDate todayDate, TodayStatus todayStatus);
List<Todo> findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByCompletedDateTimeDesc(
List<Todo> findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByCompletedDateTimeAsc(
Long userId, Type type, LocalDate todayDate, TodayStatus todayStatus);
Optional<Todo> findById(Long todoId);
Optional<Todo> findByIdAndUserId(Long todoId, Long userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TodoRepositoryTest {
LocalDate todayDate = LocalDate.of(2024, 10, 16);

//when
List<Todo> todos = todoRepository.findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByCompletedDateTimeDesc(
List<Todo> todos = todoRepository.findByUserIdAndTypeAndTodayDateAndTodayStatusOrderByCompletedDateTimeAsc(
userId, Type.TODAY, todayDate, TodayStatus.COMPLETED);

assertThat(todos).isNotEmpty();
Expand All @@ -45,7 +45,7 @@ class TodoRepositoryTest {

// 완료된 할 일은 completeDateTime이 내림차순으로 정렬되어야 함
for (int i = 0; i < todos.size() - 1; i++) {
assertThat(todos.get(i).getCompletedDateTime()).isAfterOrEqualTo(todos.get(i + 1).getCompletedDateTime());
assertThat(todos.get(i).getCompletedDateTime()).isBeforeOrEqualTo(todos.get(i + 1).getCompletedDateTime());
}
}

Expand Down

0 comments on commit 2b75ba7

Please sign in to comment.