Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -4,6 +4,7 @@ public record RetrospectOverviewResponse(
long createdRetrospectCount,
long completedRetrospectCount,
double averageCompletionRate,
double averageRetrospectLength
double averageRetrospectLength,
double averageWritingTimeMinutes
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ SELECT COALESCE(AVG(LENGTH(a.answerContent)), 0)
List<AdminRetrospectAnswerHistory> findAllByEventTimeBetweenAndAnswerEndTimeIsNotNull(
LocalDateTime startTime, LocalDateTime endTime);

List<AdminRetrospectAnswerHistory> findAllByAnswerEndTimeBetweenAndAnswerStartTimeIsNotNullAndAnswerEndTimeIsNotNull(
LocalDateTime startTime, LocalDateTime endTime);

void deleteByMemberIdAndSpaceIdAndRetrospectId(
Long memberId, Long spaceId, Long retrospectId
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,20 @@ public RetrospectOverviewResponse getRetrospectOverview(LocalDateTime startDate,

double averageRetrospectLength = adminRetrospectAnswerRepository.findAverageRetrospectLengthBetween(
startDate, endDate);
List<AdminRetrospectAnswerHistory> completedAnswerHistories =
adminRetrospectAnswerRepository.findAllByAnswerEndTimeBetweenAndAnswerStartTimeIsNotNullAndAnswerEndTimeIsNotNull(
startDate, endDate);
double averageWritingTimeMinutes = completedAnswerHistories.stream()
.mapToLong(AdminRetrospectAnswerHistory::getAnswerTime)
.average()
.orElse(0.0);

return new RetrospectOverviewResponse(
createdRetrospectCount,
completedRetrospectCount,
averageCompletionRate,
averageRetrospectLength
averageRetrospectLength,
averageWritingTimeMinutes
);
}

Expand Down
Loading