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/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java index 8942bb6..78d73b2 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ExemptionsRequest.java @@ -2,8 +2,6 @@ package ovh.herisson.Clyde.Tables.Inscription; import jakarta.persistence.*; -import org.hibernate.annotations.OnDelete; -import org.hibernate.annotations.OnDeleteAction; import ovh.herisson.Clyde.Tables.Course; import ovh.herisson.Clyde.Tables.RequestState; import ovh.herisson.Clyde.Tables.User; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ScholarshipRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ScholarshipRequest.java index 842bf90..919fc4e 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ScholarshipRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/ScholarshipRequest.java @@ -7,7 +7,6 @@ import ovh.herisson.Clyde.Tables.RequestState; import ovh.herisson.Clyde.Tables.User; import java.util.Date; -import java.util.Map; @Entity public class ScholarshipRequest { diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/UnregisterRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/UnregisterRequest.java index 9127ecb..61bec20 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/UnregisterRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Inscription/UnregisterRequest.java @@ -3,7 +3,6 @@ package ovh.herisson.Clyde.Tables.Inscription; import jakarta.persistence.*; import ovh.herisson.Clyde.Tables.Curriculum; import ovh.herisson.Clyde.Tables.RequestState; -import ovh.herisson.Clyde.Tables.User; import java.util.Date; diff --git a/frontend/src/Apps/ScientificPublications/ListResearches.vue b/frontend/src/Apps/ScientificPublications/ListResearches.vue index d056f72..67bae6d 100644 --- a/frontend/src/Apps/ScientificPublications/ListResearches.vue +++ b/frontend/src/Apps/ScientificPublications/ListResearches.vue @@ -136,6 +136,7 @@ const emit = defineEmits(["modified"]);