From 6116cbdaa4fcc9dda31b652f12ea08ba54ff7b4e Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Wed, 17 Apr 2024 12:41:58 +0200 Subject: [PATCH] added distinct languages to SQL query --- .../ScientificPublications/StatsRepository.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScientificPublications/StatsRepository.java b/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScientificPublications/StatsRepository.java index a228ac9..0dfabfe 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScientificPublications/StatsRepository.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Repositories/ScientificPublications/StatsRepository.java @@ -19,22 +19,22 @@ public interface StatsRepository extends CrudRepository { Iterable> viewsByTopics(); - @Query("select new map(r.domain as label, count(r.language) as y) from Research r group by r.domain") + @Query("select new map(r.domain as label, count(distinct r.language) as y) from Research r group by r.domain") Iterable> languageByTopics(); - @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')") + @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(distinct r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')") Iterable> languageByYears(); - @Query("select new map(to_char(r.releaseDate, 'month') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate, 'month')") + @Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r.language) as y) from Research r group by to_char(r.releaseDate, 'month')") Iterable> languageByMonths(); - @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r) as y) from Research r group by to_char(r.releaseDate,'YYYY')") + @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(distinct r) as y) from Research r group by to_char(r.releaseDate,'YYYY')") Iterable> researchesByYears(); - @Query("select new map(r.domain as label, count(r) as y) from Research r group by r.domain") + @Query("select new map(r.domain as label, count(distinct r) as y) from Research r group by r.domain") Iterable> researchesByTopics(); - @Query("select new map(to_char(r.releaseDate, 'month') as label, count(r) as y) from Research r group by to_char(r.releaseDate, 'month')") + @Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r) as y) from Research r group by to_char(r.releaseDate, 'month')") Iterable> researchesByMonth(); }