Skip to content

Commit

Permalink
[fix] #78 방목록 조회 relation 분기처리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoo0419 committed Jun 6, 2024
1 parent eae6a94 commit 7342fdb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ private boolean checkPenalty(final Question question) {
}

private String getRandomKeyword(final Profile profile){
if (profile.getKeywords() == "-"){
return "기분";
}
List<String> keywords = Arrays.stream(profile.getKeywords().split(",")).toList();
List<String> alreadyKeywords = questionRetriever.findKeywordsByProfile(
profile.getId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ public RoomListDto getAllRooms(final Long userId) {
public RoomListDto.RoomDto createRoomDto(final User user, final Room room) {
int sentence = 3, emotion = 0;
Profile myProfile = profileRetriever.findByUserAndRoom(user, room);
String myRelation = myProfile.getRelation() != null ? myProfile.getRelation().getContent() : "-";
if (!profileRetriever.existsByUserNotAndRoom(user, room)){
return RoomListDto.RoomDto.of(
room.getId(),
room.getName(),
"-",
myProfile.getRelation().getContent(),
myRelation,
"-",
emotion,
sentence
Expand All @@ -94,7 +95,7 @@ public RoomListDto.RoomDto createRoomDto(final User user, final Room room) {
Profile opponentProfile = profileRetriever.findByUserNotAndRoom(user, room);
Answer myAnswer = answerRetriever.findFirstByProfile(myProfile);
Answer opponentAnswer = answerRetriever.findFirstByProfile(opponentProfile);

String opponentRelation = opponentProfile.getRelation() != null ? opponentProfile.getRelation().getContent() : "-";
boolean myState = myAnswer.getContent() != null;
boolean opponentState = opponentAnswer.getContent() != null;

Expand All @@ -113,8 +114,8 @@ public RoomListDto.RoomDto createRoomDto(final User user, final Room room) {
room.getId(),
room.getName(),
opponentProfile.getUser().getName(),
myProfile.getRelation().getContent(),
opponentProfile.getRelation().getContent(),
myRelation,
opponentRelation,
emotion,
sentence
);
Expand Down

0 comments on commit 7342fdb

Please sign in to comment.