Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]: 월별 통계 로직 수정 #69

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public StatsResponseDTO.MonthDTO getMonthStats(LocalDate date){
List<StatsResponseDTO.MonthStatsDTO> monthStatsList = new ArrayList<>();
LocalDate localDate = date.minusDays(date.getDayOfMonth() - 1);
for(int i=0; i<date.lengthOfMonth(); i++){
int rate =0;
double rate =0.0;

Memoir memoir = memoirRepository.findByUserAndDate(user, localDate.plusDays(i)).orElse(null);
if(memoir == null){
Expand All @@ -91,18 +91,22 @@ public StatsResponseDTO.MonthDTO getMonthStats(LocalDate date){

if(memoir.getEmoticon() != null){
rate++;
System.out.println(memoir.getId());
Copy link
Contributor

Choose a reason for hiding this comment

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

혹시 출력문은 디버깅 용도인가용?

}

List<MemoirAnswer> memoirAnswerList = memoirAnswerRepository.findAllByMemoirId(memoir.getId()).stream().toList();
for(MemoirAnswer memoirAnswer: memoirAnswerList){
if(memoirAnswer.getAnswer() != null){
if(!memoirAnswer.getAnswer().equals("")){
rate++;
System.out.println("notBlank");
}
}
System.out.println(rate);
System.out.println(memoirAnswerList.size() + 1);

StatsResponseDTO.MonthStatsDTO stats = StatsResponseDTO.MonthStatsDTO.builder()
.date(localDate.plusDays(i))
.rate(rate / 4.0)
.rate(rate / (memoirAnswerList.size() + 1))
.build();
monthStatsList.add(stats);

Expand Down