Skip to content

Commit

Permalink
Merge pull request #248 from Gongjakso/feat/apply
Browse files Browse the repository at this point in the history
fix: 조회수&passCount 로직 수정
  • Loading branch information
yumzen authored Sep 23, 2024
2 parents 3660628 + ab3816a commit 309cd31
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ public TeamRes getTeam(Member member, Long contestId, Long teamId, HttpServletRe
throw new ApplicationException(ErrorCode.TEAM_NOT_FOUND_EXCEPTION);
}

updateView(team, request, response);

updatePassCount(team);

if(member != null && team.getMember().getId().equals(member.getId())){
return TeamRes.of(team, "LEADER");
}else if(member != null && applyRepository.findByTeamIdAndMemberIdAndDeletedAtIsNull(teamId, member.getId()).isPresent()){
Expand All @@ -180,8 +184,6 @@ public TeamRes getTeam(Member member, Long contestId, Long teamId, HttpServletRe
return TeamRes.of(team, "APPLIER", apply);
}

updateView(team, request, response);

// Business Logic
return TeamRes.of(team, "GENERAL");
}
Expand Down Expand Up @@ -342,4 +344,9 @@ public void updateView(Team team, HttpServletRequest request, HttpServletRespons
response.addCookie(newCookie);
}
}

public void updatePassCount(Team team) {
int passCount = applyRepository.countByTeamIdAndStatusAndDeletedAtIsNull(team.getId(), ApplyStatus.ACCEPTED);
team.updatePassCount(passCount);
}
}

0 comments on commit 309cd31

Please sign in to comment.