From 7342fdbb5e5c062d4e133767f05f0e5305d5b22b Mon Sep 17 00:00:00 2001 From: minwoo0419 Date: Thu, 6 Jun 2024 20:07:54 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[fix]=20#78=20=EB=B0=A9=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20relation=20=EB=B6=84=EA=B8=B0=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/service/question/QuestionService.java | 3 +++ .../com/telepigeon/server/service/room/RoomService.java | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/telepigeon/server/service/question/QuestionService.java b/src/main/java/com/telepigeon/server/service/question/QuestionService.java index 13f36ec..d2accc0 100644 --- a/src/main/java/com/telepigeon/server/service/question/QuestionService.java +++ b/src/main/java/com/telepigeon/server/service/question/QuestionService.java @@ -122,6 +122,9 @@ private boolean checkPenalty(final Question question) { } private String getRandomKeyword(final Profile profile){ + if (profile.getKeywords() == "-"){ + return "기분"; + } List keywords = Arrays.stream(profile.getKeywords().split(",")).toList(); List alreadyKeywords = questionRetriever.findKeywordsByProfile( profile.getId(), diff --git a/src/main/java/com/telepigeon/server/service/room/RoomService.java b/src/main/java/com/telepigeon/server/service/room/RoomService.java index 621bbf0..49f1877 100644 --- a/src/main/java/com/telepigeon/server/service/room/RoomService.java +++ b/src/main/java/com/telepigeon/server/service/room/RoomService.java @@ -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 @@ -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; @@ -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 ); From bbffa0a76b73850c5dd07ec51af14694774da4fd Mon Sep 17 00:00:00 2001 From: minwoo0419 Date: Thu, 6 Jun 2024 20:08:25 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[fix]=20#78=20=EB=B0=A9=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20relation=20=EB=B6=84=EA=B8=B0=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=802?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/telepigeon/server/service/question/QuestionService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/telepigeon/server/service/question/QuestionService.java b/src/main/java/com/telepigeon/server/service/question/QuestionService.java index d2accc0..71f777b 100644 --- a/src/main/java/com/telepigeon/server/service/question/QuestionService.java +++ b/src/main/java/com/telepigeon/server/service/question/QuestionService.java @@ -122,7 +122,7 @@ private boolean checkPenalty(final Question question) { } private String getRandomKeyword(final Profile profile){ - if (profile.getKeywords() == "-"){ + if (Objects.equals(profile.getKeywords(), "-")){ return "기분"; } List keywords = Arrays.stream(profile.getKeywords().split(",")).toList();