From d4fa80a4178876f9dce8bf2f4ee27a10ef1dd840 Mon Sep 17 00:00:00 2001 From: Eduard Frankford <e.frankford@student.uibk.ac.at> Date: Sat, 15 May 2021 15:16:28 +0200 Subject: [PATCH] now working with every email before I had michaels email hard coded for testing --- .../ac/uibk/gitsearch/web/rest/SearchResource.java | 12 ++++-------- .../webapp/app/account/achievements.component.ts | 10 +--------- src/main/webapp/app/search/service/search-service.ts | 4 ++-- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/main/java/at/ac/uibk/gitsearch/web/rest/SearchResource.java b/src/main/java/at/ac/uibk/gitsearch/web/rest/SearchResource.java index 42aa1c99d..c2cc5ae04 100644 --- a/src/main/java/at/ac/uibk/gitsearch/web/rest/SearchResource.java +++ b/src/main/java/at/ac/uibk/gitsearch/web/rest/SearchResource.java @@ -75,15 +75,11 @@ public class SearchResource { SearchInputDTO.PAGE_SIZE); } - @GetMapping("/user/{login}/statistics/views") + @GetMapping("/user/{email}/statistics/views") @PreAuthorize("hasAnyRole('USER')") - public ResponseEntity<StatisticsDTO> searchUserStatistics(@PathVariable String login) throws IOException { - log.debug("REST request to search statistics for user {}", login); - SearchInputDTO search = new SearchInputDTO(); - SearchInputMetadataDTO metadata = new SearchInputMetadataDTO(); - metadata.setAuthor(login); - search.setMetadata(metadata); - SearchResultsDTO results = searchService.searchResultForAuthorEmail("michael.breu@uibk.ac.at", 1000); + public ResponseEntity<StatisticsDTO> searchUserStatistics(@PathVariable String email) throws IOException { + log.debug("REST request to search statistics for user {}", email); + SearchResultsDTO results = searchService.searchResultForAuthorEmail(email, 1000); int totalAmountOfViews = 0; int totalAmountOfDownloads = 0; for (SearchResultDTO result : results.getSearchResult()) { diff --git a/src/main/webapp/app/account/achievements.component.ts b/src/main/webapp/app/account/achievements.component.ts index 79902b90b..5d050ed28 100644 --- a/src/main/webapp/app/account/achievements.component.ts +++ b/src/main/webapp/app/account/achievements.component.ts @@ -29,15 +29,7 @@ export class AchievementsComponent implements OnInit { // eslint-disable-next-line no-console console.log( - 'Data: Number of Downloads: ' + - data.downloads + - ' Number of views: ' + - data.views + - ' for account ' + - this.account.firstName + - ' ' + - this.account.lastName + - this.config.views[0] + 'Data: Number of Downloads: ' + data.downloads + ' Number of views: ' + data.views + ' for account ' + this.account.email ); } }, diff --git a/src/main/webapp/app/search/service/search-service.ts b/src/main/webapp/app/search/service/search-service.ts index 6579bd09a..67747d3e0 100644 --- a/src/main/webapp/app/search/service/search-service.ts +++ b/src/main/webapp/app/search/service/search-service.ts @@ -28,8 +28,8 @@ export class SearchService { return this.http.get<Statistics>(this.resourceSearchUrlStatisticsForExercise + exerciseID); } - getStatisticsForUser(login: string): Observable<Statistics> { - return this.http.get<Statistics>('api/user/' + login + '/statistics/views'); + getStatisticsForUser(email: string): Observable<Statistics> { + return this.http.get<Statistics>('api/user/' + email + '/statistics/views'); } /** -- GitLab