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 @@ -133,6 +133,7 @@ ResponseEntity<ApiResponse<Void>> completeParticipant(
- approvedCount: 진행중 인원
- feedbackCompletedCount: 피드백 완료 인원
- testCompletedCount: 테스트 완료 인원
- paidCount: 리워드 지급 완료 인원
- rejectedCount: 거절됨 인원
- totalCount: 전체 신청 인원
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,35 @@ public record ParticipationStatisticsResponse(
@Schema(description = "피드백 완료 인원", example = "7")
Long feedbackCompletedCount,

@Schema(description = "테스트 완료 인원", example = "8")
@Schema(description = "테스트 완료 (지급 대기) 인원", example = "5")
Long testCompletedCount,

@Schema(description = "리워드 지급 완료 인원", example = "3")
Long paidCount,

@Schema(description = "거절됨 인원", example = "3")
Long rejectedCount,

@Schema(description = "전체 신청 인원", example = "33")
Long totalCount
) {
public static ParticipationStatisticsResponse of(Long pendingCount, Long approvedCount,
Long feedbackCompletedCount, Long testCompletedCount,
Long rejectedCount) {
Long total = pendingCount + approvedCount + feedbackCompletedCount + testCompletedCount + rejectedCount;
public static ParticipationStatisticsResponse of(
Long pendingCount,
Long approvedCount,
Long feedbackCompletedCount,
Long testCompletedCount,
Long paidCount,
Long rejectedCount) {

Long total = pendingCount + approvedCount + feedbackCompletedCount
+ testCompletedCount + paidCount + rejectedCount;

return new ParticipationStatisticsResponse(
pendingCount,
approvedCount,
feedbackCompletedCount,
testCompletedCount,
paidCount,
rejectedCount,
total
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ Long countByPostIdAndStatusAndIsPaid(
"COALESCE(COUNT(CASE WHEN status = 'PENDING' THEN 1 END), 0) as pendingCount, " +
"COALESCE(COUNT(CASE WHEN status = 'APPROVED' THEN 1 END), 0) as approvedCount, " +
"COALESCE(COUNT(CASE WHEN status = 'FEEDBACK_COMPLETED' THEN 1 END), 0) as feedbackCompletedCount, " +
"COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' THEN 1 END), 0) as testCompletedCount, " +
"COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' AND is_paid = false THEN 1 END), 0) as testCompletedCount, " +
"COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' AND is_paid = true THEN 1 END), 0) as paidCount, " +
"COALESCE(COUNT(CASE WHEN status = 'REJECTED' THEN 1 END), 0) as rejectedCount " +
"FROM participations " +
"WHERE post_id = :postId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public ParticipationStatisticsResponse getPostApplicationStatistics(Long postId,
stats.approvedCount(),
stats.feedbackCompletedCount(),
stats.testCompletedCount(),
stats.paidCount(),
stats.rejectedCount()
);
}
Expand Down Expand Up @@ -380,7 +381,7 @@ private ParticipationStatsDto extractParticipationStats(Long postId) {
List<Object[]> resultList = participationRepository.getParticipationStatsByPostId(postId);

if (resultList.isEmpty()) {
return new ParticipationStatsDto(0L, 0L, 0L, 0L, 0L);
return new ParticipationStatsDto(0L, 0L, 0L, 0L, 0L, 0L);
}

Object[] result = resultList.get(0);
Expand All @@ -389,8 +390,9 @@ private ParticipationStatsDto extractParticipationStats(Long postId) {
extractLongValue(result[0]), // pendingCount
extractLongValue(result[1]), // approvedCount
extractLongValue(result[2]), // feedbackCompletedCount
extractLongValue(result[3]), // testCompletedCount
extractLongValue(result[4]) // rejectedCount
extractLongValue(result[3]), // testCompletedCount (지급 대기)
extractLongValue(result[4]), // paidCount (지급 완료)
extractLongValue(result[5]) // rejectedCount
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public record ParticipationStatsDto(
Long approvedCount,
Long feedbackCompletedCount,
Long testCompletedCount,
Long paidCount,
Long rejectedCount
) {
}