Skip to content

Commit

Permalink
Merge pull request #119 from Happy-HOBAK/fix/118
Browse files Browse the repository at this point in the history
[#118] λ‚ μ§œ 였λ₯˜ μˆ˜μ •
  • Loading branch information
yel-m authored Jun 3, 2024
2 parents 7f2ec1b + 2fc87d0 commit e176b1a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public AverageHappinessResponseDto getAnnualHappiness(User user) {
return ReportConverter.toAverageHappinessResponseDto(averageHappiness,level,level.getEmoji()); }
public AverageHappinessResponseDto getMonthlyHappiness(User user) {
LocalDateTime startOfMonth = LocalDateTime.of(currentYear, currentMonth, 1, 0, 0);
LocalDateTime endOfMonth = LocalDateTime.of(currentYear, currentMonth, 31, 23, 59, 59);
LocalDateTime endOfMonth = LocalDateTime.of(currentYear, currentMonth, currentDate.lengthOfMonth(), 23, 59, 59);
double totalHappiness = recordRepository.findAllByCreatedAtBetweenAndUser(startOfMonth, endOfMonth, user).stream().mapToInt(Record::getHappiness).sum();
double averageHappiness = totalHappiness / recordRepository.countAllByCreatedAtBetweenAndUser(startOfMonth, endOfMonth, user);
averageHappiness = Math.round(averageHappiness * 100.0) / 100.0;
Expand Down

0 comments on commit e176b1a

Please sign in to comment.