Skip to content

Commit

Permalink
[SAMBAD-194] 나와 같은 답변 모임원 조회 시, 내가 제외되도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kkjsw17 committed Aug 15, 2024
1 parent 5b43698 commit 6417beb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public SelectedAnswerResponse getSelectedSameAnswer(Long userId, Long meetingId,
List<MeetingMember> members = meetingAnswerRepository.findMeetingMembersSelectWith(
meetingQuestionId, MeetingAnswer.getDistinctAnswerIds(meetingAnswers));

// 자기 자신은 제외
members.remove(meetingMember);

return SelectedAnswerResponse.from(members, meetingAnswers);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public List<MeetingAnswer> findMostSelectedMeetingAnswer(Long meetingQuestionId)
}

return queryFactory.selectFrom(meetingAnswer)
.where(meetingAnswer.answer.id.eq(mostSelectedAnswerId))
.where(
meetingAnswer.answer.id.eq(mostSelectedAnswerId),
meetingAnswer.meetingQuestion.id.eq(meetingQuestionId)
)
.fetch();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public record SelectedAnswerResponse(
@Schema(description = "답변 내용", example = "[\"토마토\"]", requiredMode = REQUIRED)
List<String> content,

@Schema(description = "답변 수", example = "3", requiredMode = REQUIRED)
@Schema(description = "해당 모임을 선택한 모임원 수", example = "3", requiredMode = REQUIRED)
int count,

@Schema(description = "선택한 멤버들", requiredMode = REQUIRED)
@Schema(description = "선택한 모임원 목록", requiredMode = REQUIRED)
List<MeetingMemberListResponseDetail> selectedMembers
) {
public static SelectedAnswerResponse from(List<MeetingMember> members, List<MeetingAnswer> meetingAnswers) {
Expand All @@ -27,7 +27,7 @@ public static SelectedAnswerResponse from(List<MeetingMember> members, List<Meet
.map(MeetingAnswer::getAnswerContent)
.distinct()
.toList(),
meetingAnswers.size(),
members.size(),
MeetingMemberListResponse.from(members).contents()
);
}
Expand Down

0 comments on commit 6417beb

Please sign in to comment.