Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Add statistics functionality#65

Closed
kristinamaric3 wants to merge 2 commits intomasterfrom
Send_notification_mail_when_report_status_change_#52
Closed

Add statistics functionality#65
kristinamaric3 wants to merge 2 commits intomasterfrom
Send_notification_mail_when_report_status_change_#52

Conversation

@kristinamaric3
Copy link
Copy Markdown
Collaborator

No description provided.

import lombok.Data;
import lombok.NoArgsConstructor;

public interface StatisticsPieDTO {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a more fit name for this be PercentageStatistics or something like that?

return ResponseEntity.ok(statisticsService.getStatisticsForNumberOfReportsByDepartmentName(year));
}

@GetMapping("/byDepartment")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" +
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use uppercase words for SQL words, it would be easier to read query


@Override
public List<StatisticsPieDTO> getStatisticsForNumberOfReportsByDepartmentName(Integer year) {
return evaluatesRepository.getNumberOfReportsByDepartmentName(year);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add log statements here

public interface StatisticsService {

List<StatisticsDTO> getStatistics(Integer year);
List<StatisticsPieDTO> getStatisticsForNumberOfReportsByDepartmentName(Integer year);
Copy link
Copy Markdown
Owner

@Corke123 Corke123 Aug 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to use more meaningful names here. It is not clear to me what getStatisticsForNumberOfReportsByDepartmentName does. Feel free to rename other methods as well

@Corke123 Corke123 closed this Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants