From b8e9ea968a2d5e50f1329d6ca994dbea410a00e7 Mon Sep 17 00:00:00 2001 From: matiwinnetou Date: Tue, 10 Oct 2023 16:00:47 +0200 Subject: [PATCH] feat: fix for category level stats. (#444) Co-authored-by: Mateusz Czeladka --- .../cardano/foundation/voting/repository/VoteRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend-services/voting-app/src/main/java/org/cardano/foundation/voting/repository/VoteRepository.java b/backend-services/voting-app/src/main/java/org/cardano/foundation/voting/repository/VoteRepository.java index ce15aafff..51863c29c 100644 --- a/backend-services/voting-app/src/main/java/org/cardano/foundation/voting/repository/VoteRepository.java +++ b/backend-services/voting-app/src/main/java/org/cardano/foundation/voting/repository/VoteRepository.java @@ -24,7 +24,7 @@ public interface VoteRepository extends JpaRepository { @Query("SELECT v.categoryId as categoryId, COUNT(v) AS totalVoteCount, SUM(v.votingPower) AS totalVotingPower FROM Vote v WHERE v.eventId = :eventId GROUP BY categoryId") List getHighLevelCategoryLevelStats(@Param("eventId") String eventId); - @Query("SELECT v.categoryId as categoryId, v.proposalId AS proposalId, COUNT(v) AS totalVoteCount, SUM(v.votingPower) AS totalVotingPower FROM Vote v WHERE v.eventId = :eventId AND v.categoryId = :categoryId GROUP BY proposalId") + @Query("SELECT v.categoryId as categoryId, v.proposalId AS proposalId, COUNT(v) AS totalVoteCount, SUM(v.votingPower) AS totalVotingPower FROM Vote v WHERE v.eventId = :eventId AND v.categoryId = :categoryId GROUP BY categoryId, proposalId ORDER BY totalVotingPower DESC, totalVoteCount DESC") List getCategoryLevelStats(@Param("eventId") String eventId, @Param("categoryId") String categoryId); interface CategoryProposalProjection {