This repository was archived by the owner on Jan 13, 2026. It is now read-only.
Closed
Conversation
Corke123
reviewed
Aug 25, 2021
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| public interface StatisticsPieDTO { |
Owner
There was a problem hiding this comment.
Would a more fit name for this be PercentageStatistics or something like that?
| return ResponseEntity.ok(statisticsService.getStatisticsForNumberOfReportsByDepartmentName(year)); | ||
| } | ||
|
|
||
| @GetMapping("/byDepartment") |
Owner
There was a problem hiding this comment.
Suggested change
| @GetMapping("/byDepartment") | |
| @GetMapping("/by-department") |
We don't use camel case notation for naming endpoints
| return ResponseEntity.ok(statisticsService.getStatistics(year)); | ||
| } | ||
|
|
||
| @GetMapping("/all") |
Owner
There was a problem hiding this comment.
all what? All statistics?? Use a more meaningful name for this
| @Query(value = "SELECT CASE WHEN count(*) > 0 THEN true ELSE false END FROM Evaluates WHERE userId = :userId AND reportId = :reportId") | ||
| boolean existsByReportAndUser(Long reportId, Long userId); | ||
|
|
||
| @Query(value = "select (count(r.id) / (select count(*) from report) * 100) as y, name\n" + |
Owner
There was a problem hiding this comment.
Use uppercase words for SQL words, it would be easier to read query
|
|
||
| @Override | ||
| public List<StatisticsPieDTO> getStatisticsForNumberOfReportsByDepartmentName(Integer year) { | ||
| return evaluatesRepository.getNumberOfReportsByDepartmentName(year); |
| public interface StatisticsService { | ||
|
|
||
| List<StatisticsDTO> getStatistics(Integer year); | ||
| List<StatisticsPieDTO> getStatisticsForNumberOfReportsByDepartmentName(Integer year); |
Owner
There was a problem hiding this comment.
Try to use more meaningful names here. It is not clear to me what getStatisticsForNumberOfReportsByDepartmentName does. Feel free to rename other methods as well
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.