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 ae025ce..95f4da6 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 @@ -11,17 +11,30 @@ public interface StatsRepository extends CrudRepository { @Query("select new map(to_char(r.releaseDate, 'month') as label, sum(r.views) as y) from Research r group by to_char(r.releaseDate, 'month')") Iterable> viewsByMonths(); -/** + @Query("select new map(to_char(r.releaseDate,'year') as label, sum (r.views) as y) from Research r group by to_char(r.releaseDate,'year')") Iterable> viewsByYears(); + + + @Query("select new map(r.domain as label, sum(r.views) as y) from Research r group by r.domain") Iterable> viewsByTopics(); - Iterable> coAuthorByMonths(); - Iterable> coAuthorsByTopics(); + + + @Query("select new map(r.domain as label, r.language as y) from Research r group by r.domain") Iterable> languageByTopics(); + + @Query("select new map(to_char(r.releaseDate,'year') as label, r.language as y) from Research r group by to_char(r.releaseDate,'year')") Iterable> languageByYears(); + + @Query("select new map(to_char(r.releaseDate, 'month') as label, r.language as y) from Research r group by to_char(r.releaseDate, 'month')") Iterable> languageByMonths(); + + @Query("select new map(to_char(r.releaseDate,'year') as label, count(r) as y) from Research r group by to_char(r.releaseDate,'year')") Iterable> researchesByYears(); + + @Query("select new map(r.domain as label, count(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')") Iterable> researchesByMonth(); -**/ } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/ScientificPublications/StatisticsService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/ScientificPublications/StatisticsService.java index d547943..886285b 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/ScientificPublications/StatisticsService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/ScientificPublications/StatisticsService.java @@ -29,8 +29,17 @@ public class StatisticsService { ArrayList>> toReturn = new ArrayList<>(); + toReturn.add(statsRepo.viewsByYears()); toReturn.add(statsRepo.viewsByMonths()); + toReturn.add(statsRepo.viewsByTopics()); + toReturn.add(statsRepo.researchesByYears()); + toReturn.add(statsRepo.researchesByMonth()); + toReturn.add(statsRepo.researchesByTopics()); + + toReturn.add(statsRepo.languageByYears()); + toReturn.add(statsRepo.languageByMonths()); + toReturn.add(statsRepo.languageByTopics()); return toReturn; }