From fa2deca1b9ca9588dbdc24bd00b19f1af249c617 Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Mon, 22 Apr 2024 10:02:45 +0200 Subject: [PATCH] fix once again the stats and translations --- .../StatsRepository.java | 34 +++++++++---------- .../StatisticsService.java | 18 +++++----- .../ResearchComponent.vue | 2 +- 3 files changed, 27 insertions(+), 27 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 6dc1726..4c6a6e0 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 @@ -15,33 +15,33 @@ import java.util.Map; 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, 'month') as label, sum(r.views) as y) from Research r where r.author.id = ?1 group by to_char(r.releaseDate, 'month')") + Iterable> viewsByMonths(long researcherId); @Query("select new map(to_char(r.releaseDate,'YYYY') as label, sum (r.views) as y) from Research r group by to_char(r.releaseDate,'YYYY')") - Iterable> viewsByYears(); + Iterable> viewsByYears(long researcherId); - @Query("select new map(r.domain as label, sum(r.views) as y) from Research r group by r.domain") - Iterable> viewsByTopics(); + @Query("select new map(r.domain as label, sum(r.views) as y) from Research r where r.author.id = ?1 group by r.domain") + Iterable> viewsByTopics(long researcherId); - @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(r.domain as label, count(distinct r.language) as y) from Research r where r.author.id = ?1 group by r.domain") + Iterable> languageByTopics(long researcherId); - @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,'YYYY') as label, count(distinct r.language) as y) from Research r where r.author.id = ?1 group by to_char(r.releaseDate,'YYYY')") + Iterable> languageByYears(long researcherId); - @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, 'month') as label, count(distinct r.language) as y) from Research r where r.author.id = ?1 group by to_char(r.releaseDate, 'month')") + Iterable> languageByMonths(long researcherId); - @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(to_char(r.releaseDate,'YYYY') as label, count(distinct r) as y) from Research r where r.author.id = ?1 group by to_char(r.releaseDate,'YYYY')") + Iterable> researchesByYears(long researcherId); - @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(r.domain as label, count(distinct r) as y) from Research r where r.author.id = ?1 group by r.domain") + Iterable> researchesByTopics(long researcherId); - @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(); + @Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r) as y) from Research r where r.author.id = ?1 group by to_char(r.releaseDate, 'month')") + Iterable> researchesByMonth(long researcherId); } 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 350feca..9f47466 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 @@ -34,17 +34,17 @@ public class StatisticsService { ArrayList>> toReturn = new ArrayList<>(); - toReturn.add(statsRepo.viewsByYears()); - toReturn.add(statsRepo.viewsByMonths()); - toReturn.add(statsRepo.viewsByTopics()); + toReturn.add(statsRepo.viewsByYears(researcher.getId())); + toReturn.add(statsRepo.viewsByMonths(researcher.getId())); + toReturn.add(statsRepo.viewsByTopics(researcher.getId())); - toReturn.add(statsRepo.researchesByYears()); - toReturn.add(statsRepo.researchesByMonth()); - toReturn.add(statsRepo.researchesByTopics()); + toReturn.add(statsRepo.researchesByYears(researcher.getId())); + toReturn.add(statsRepo.researchesByMonth(researcher.getId())); + toReturn.add(statsRepo.researchesByTopics(researcher.getId())); - toReturn.add(statsRepo.languageByYears()); - toReturn.add(statsRepo.languageByMonths()); - toReturn.add(statsRepo.languageByTopics()); + toReturn.add(statsRepo.languageByYears(researcher.getId())); + toReturn.add(statsRepo.languageByMonths(researcher.getId())); + toReturn.add(statsRepo.languageByTopics(researcher.getId())); return toReturn; } } \ No newline at end of file diff --git a/frontend/src/Apps/ScientificPublications/ResearchComponent.vue b/frontend/src/Apps/ScientificPublications/ResearchComponent.vue index 3034e0d..13524f9 100644 --- a/frontend/src/Apps/ScientificPublications/ResearchComponent.vue +++ b/frontend/src/Apps/ScientificPublications/ResearchComponent.vue @@ -103,7 +103,7 @@ async function articleClicked(){ + {{i18n("SeeBibTex")}}