diff --git a/src/main/java/swm_nm/morandi/domain/testInfo/service/LatestTestInfoService.java b/src/main/java/swm_nm/morandi/domain/testInfo/service/LatestTestInfoService.java index 5cf91063..0f9c0649 100644 --- a/src/main/java/swm_nm/morandi/domain/testInfo/service/LatestTestInfoService.java +++ b/src/main/java/swm_nm/morandi/domain/testInfo/service/LatestTestInfoService.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import swm_nm.morandi.aop.annotation.Logging; @@ -32,7 +33,7 @@ public class LatestTestInfoService { public List getTestRecordDtosLatest() { Long memberId = SecurityUtils.getCurrentMemberId(); //페이징하여 최근 4개의 테스트 기록을 가져옴 - Pageable pageable = PageRequest.of(0, 4); + Pageable pageable = PageRequest.of(0, 4, Sort.by(Sort.Direction.DESC, "testDate")); List recentTests = testRepository.findAllTestsByMember_MemberIdAndTestStatus(memberId, TestStatus.COMPLETED, pageable); //테스트 기록을 받아와서 dto로 변환하면서 getAttemptProblemDtos를 통해 테스트 문제들을 dto로 변환