Skip to content

Commit

Permalink
fix: memberId 조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongh00 committed Feb 4, 2024
1 parent 3576df2 commit de43f4f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public List<MyPageLegislator> getMyLegislatorAttendance(String userId) {

for (Long legislatorId : legislatorIds) {
LegislateLaw law = lawQueryService.findLegislatorLaw(legislatorId);
Integer score = myPageQueryService.getLegislatorVoteScore(law.getId());
Integer score = myPageQueryService.getLegislatorVoteScore(law.getId(), memberId);
Integer totalScore = voteQueryService.getLegislatorTotalScore(law.getName());

MyPageLegislator myPageLegislator = MyPageLegislator.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public Integer getVoteScore(Long lawId) {
return (vote != null) ? vote.getScore() : 0;
}

public Integer getLegislatorVoteScore(Long lawId) {
public Integer getLegislatorVoteScore(Long lawId, Long memberId) {

LegislateVote vote = legislateVoteRepository.findLegislateVoteByLegislateLawId(lawId);
LegislateVote vote = legislateVoteRepository.findLegislateVoteByLegislateLawIdAndMemberId(lawId, memberId);
return vote.getScore();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public interface LegislateVoteRepository extends JpaRepository<LegislateVote, Lo

List<LegislateVote> findLegislateVotesByMemberId(Long memberId);

LegislateVote findLegislateVoteByLegislateLawId(Long lawId);
LegislateVote findLegislateVoteByLegislateLawIdAndMemberId(Long lawId, Long memberId);
}

0 comments on commit de43f4f

Please sign in to comment.