Skip to content

Commit f8abd97

Browse files
authored
Merge pull request #202 from PROJECT-NEXUS-JS/feat/#201
feat/#201: ์ฐธ๊ฐ€ ์‹ ์ฒญ ํ†ต๊ณ„์— ๋ฆฌ์›Œ๋“œ ์ง€๊ธ‰ ์ธ์› ์ถ”๊ฐ€
2 parents efb8e45 + 38994f9 commit f8abd97

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

โ€Žsrc/main/java/com/example/nexus/app/participation/controller/doc/ParticipationControllerDoc.javaโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ ResponseEntity<ApiResponse<Void>> completeParticipant(
133133
- approvedCount: ์ง„ํ–‰์ค‘ ์ธ์›
134134
- feedbackCompletedCount: ํ”ผ๋“œ๋ฐฑ ์™„๋ฃŒ ์ธ์›
135135
- testCompletedCount: ํ…Œ์ŠคํŠธ ์™„๋ฃŒ ์ธ์›
136+
- paidCount: ๋ฆฌ์›Œ๋“œ ์ง€๊ธ‰ ์™„๋ฃŒ ์ธ์›
136137
- rejectedCount: ๊ฑฐ์ ˆ๋จ ์ธ์›
137138
- totalCount: ์ „์ฒด ์‹ ์ฒญ ์ธ์›
138139
"""

โ€Žsrc/main/java/com/example/nexus/app/participation/controller/dto/response/ParticipationStatisticsResponse.javaโ€Ž

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,35 @@ public record ParticipationStatisticsResponse(
1313
@Schema(description = "ํ”ผ๋“œ๋ฐฑ ์™„๋ฃŒ ์ธ์›", example = "7")
1414
Long feedbackCompletedCount,
1515

16-
@Schema(description = "ํ…Œ์ŠคํŠธ ์™„๋ฃŒ ์ธ์›", example = "8")
16+
@Schema(description = "ํ…Œ์ŠคํŠธ ์™„๋ฃŒ (์ง€๊ธ‰ ๋Œ€๊ธฐ) ์ธ์›", example = "5")
1717
Long testCompletedCount,
1818

19+
@Schema(description = "๋ฆฌ์›Œ๋“œ ์ง€๊ธ‰ ์™„๋ฃŒ ์ธ์›", example = "3")
20+
Long paidCount,
21+
1922
@Schema(description = "๊ฑฐ์ ˆ๋จ ์ธ์›", example = "3")
2023
Long rejectedCount,
2124

2225
@Schema(description = "์ „์ฒด ์‹ ์ฒญ ์ธ์›", example = "33")
2326
Long totalCount
2427
) {
25-
public static ParticipationStatisticsResponse of(Long pendingCount, Long approvedCount,
26-
Long feedbackCompletedCount, Long testCompletedCount,
27-
Long rejectedCount) {
28-
Long total = pendingCount + approvedCount + feedbackCompletedCount + testCompletedCount + rejectedCount;
28+
public static ParticipationStatisticsResponse of(
29+
Long pendingCount,
30+
Long approvedCount,
31+
Long feedbackCompletedCount,
32+
Long testCompletedCount,
33+
Long paidCount,
34+
Long rejectedCount) {
35+
36+
Long total = pendingCount + approvedCount + feedbackCompletedCount
37+
+ testCompletedCount + paidCount + rejectedCount;
38+
2939
return new ParticipationStatisticsResponse(
3040
pendingCount,
3141
approvedCount,
3242
feedbackCompletedCount,
3343
testCompletedCount,
44+
paidCount,
3445
rejectedCount,
3546
total
3647
);

โ€Žsrc/main/java/com/example/nexus/app/participation/repository/ParticipationRepository.javaโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ Long countByPostIdAndStatusAndIsPaid(
164164
"COALESCE(COUNT(CASE WHEN status = 'PENDING' THEN 1 END), 0) as pendingCount, " +
165165
"COALESCE(COUNT(CASE WHEN status = 'APPROVED' THEN 1 END), 0) as approvedCount, " +
166166
"COALESCE(COUNT(CASE WHEN status = 'FEEDBACK_COMPLETED' THEN 1 END), 0) as feedbackCompletedCount, " +
167-
"COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' THEN 1 END), 0) as testCompletedCount, " +
167+
"COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' AND is_paid = false THEN 1 END), 0) as testCompletedCount, " +
168+
"COALESCE(COUNT(CASE WHEN status = 'TEST_COMPLETED' AND is_paid = true THEN 1 END), 0) as paidCount, " +
168169
"COALESCE(COUNT(CASE WHEN status = 'REJECTED' THEN 1 END), 0) as rejectedCount " +
169170
"FROM participations " +
170171
"WHERE post_id = :postId",

โ€Žsrc/main/java/com/example/nexus/app/participation/service/ParticipationService.javaโ€Ž

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public ParticipationStatisticsResponse getPostApplicationStatistics(Long postId,
249249
stats.approvedCount(),
250250
stats.feedbackCompletedCount(),
251251
stats.testCompletedCount(),
252+
stats.paidCount(),
252253
stats.rejectedCount()
253254
);
254255
}
@@ -380,7 +381,7 @@ private ParticipationStatsDto extractParticipationStats(Long postId) {
380381
List<Object[]> resultList = participationRepository.getParticipationStatsByPostId(postId);
381382

382383
if (resultList.isEmpty()) {
383-
return new ParticipationStatsDto(0L, 0L, 0L, 0L, 0L);
384+
return new ParticipationStatsDto(0L, 0L, 0L, 0L, 0L, 0L);
384385
}
385386

386387
Object[] result = resultList.get(0);
@@ -389,8 +390,9 @@ private ParticipationStatsDto extractParticipationStats(Long postId) {
389390
extractLongValue(result[0]), // pendingCount
390391
extractLongValue(result[1]), // approvedCount
391392
extractLongValue(result[2]), // feedbackCompletedCount
392-
extractLongValue(result[3]), // testCompletedCount
393-
extractLongValue(result[4]) // rejectedCount
393+
extractLongValue(result[3]), // testCompletedCount (์ง€๊ธ‰ ๋Œ€๊ธฐ)
394+
extractLongValue(result[4]), // paidCount (์ง€๊ธ‰ ์™„๋ฃŒ)
395+
extractLongValue(result[5]) // rejectedCount
394396
);
395397
}
396398

โ€Žsrc/main/java/com/example/nexus/app/participation/service/dto/ParticipationStatsDto.javaโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public record ParticipationStatsDto(
55
Long approvedCount,
66
Long feedbackCompletedCount,
77
Long testCompletedCount,
8+
Long paidCount,
89
Long rejectedCount
910
) {
1011
}

0 commit comments

Comments
ย (0)