From 30396acda4350d389c8fa74b6ee3c9f231726bef Mon Sep 17 00:00:00 2001 From: This-Is-Ko <52279273+This-Is-Ko@users.noreply.github.com> Date: Mon, 23 Sep 2024 22:37:37 +1000 Subject: [PATCH] Fixed highlights page --- .../com/ko/footballupdater/repositories/PostRepository.java | 6 +++--- .../services/PerformanceAnalysisService.java | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ko/footballupdater/repositories/PostRepository.java b/src/main/java/com/ko/footballupdater/repositories/PostRepository.java index 0f7f742..bf229d4 100644 --- a/src/main/java/com/ko/footballupdater/repositories/PostRepository.java +++ b/src/main/java/com/ko/footballupdater/repositories/PostRepository.java @@ -17,6 +17,8 @@ public interface PostRepository extends CrudRepository { List findAllByOrderByDateGeneratedDesc(Pageable pageable); + List findAllByOrderByDateGeneratedAsc(Pageable pageable); + List findByPostedStatus(boolean postedStatus); List findByPostedStatusOrderByDateGeneratedDesc(boolean postedStatus, Pageable pageable); @@ -24,6 +26,4 @@ public interface PostRepository extends CrudRepository { @Modifying @Query("update Post p set p.postedStatus = :postedStatus where p.id = :id") void updatePostSetPostedStatusForId(@Param("postedStatus") boolean postedStatus, @Param("id") int id); - - -} \ No newline at end of file +} diff --git a/src/main/java/com/ko/footballupdater/services/PerformanceAnalysisService.java b/src/main/java/com/ko/footballupdater/services/PerformanceAnalysisService.java index 3fc61ca..905f74a 100644 --- a/src/main/java/com/ko/footballupdater/services/PerformanceAnalysisService.java +++ b/src/main/java/com/ko/footballupdater/services/PerformanceAnalysisService.java @@ -21,7 +21,7 @@ public class PerformanceAnalysisService { private PostRepository postRepository; public Map> checkMatchPerformances() { - List recentPosts = postRepository.findAllByOrderByDateGeneratedDesc(PageRequest.of(1, 10)); + List recentPosts = postRepository.findAllByOrderByDateGeneratedDesc(PageRequest.of(0, 20)); Map> postsWithHighlights = new HashMap<>(); // Check stats in each recent post for highlights @@ -61,5 +61,4 @@ public Map checkHighlightsInMatch(Post post) { } return highlights; } - }