Skip to content

Commit 080a224

Browse files
authored
Merge pull request #152 from prgrms-web-devcourse-final-project/fix
[FIX]: 사용자 통계 시나리오 개수 수정
2 parents 1bf2e0d + 9d614f7 commit 080a224

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

back/src/main/java/com/back/domain/scenario/repository/ScenarioRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,6 @@ void updateRepresentativeStatus(
9595
@Param("userId") Long userId,
9696
@Param("scenarioId") Long scenarioId
9797
);
98+
99+
int countByUserIdAndDecisionLineIsNotNullAndStatus(Long userId, ScenarioStatus status);
98100
}

back/src/main/java/com/back/domain/user/service/UserInfoService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public UserStatsResponse getMyStats(Long userId) {
5555
User user = userRepository.findById(userId)
5656
.orElseThrow(() -> new EntityNotFoundException("User not found: " + userId));
5757

58-
int scenarioCount = scenarioRepository.countByUserId(userId);
58+
int scenarioCount = scenarioRepository.countByUserIdAndDecisionLineIsNotNullAndStatus(
59+
userId, ScenarioStatus.COMPLETED);
5960
int totalPoints = scenarioRepository.sumTotalByUserId(userId);
6061
int postCount = postRepository.countByUserId(userId);
6162
int commentCount = commentRepository.countByUserId(userId);

0 commit comments

Comments
 (0)