Skip to content

Commit

Permalink
Merge pull request #77 from TelePigeon/fix/76
Browse files Browse the repository at this point in the history
[fix] 방목록 조회 분기처리 추가
  • Loading branch information
minwoo0419 authored Jun 6, 2024
2 parents be3c746 + c67dc88 commit eae6a94
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/com/telepigeon/server/service/room/RoomService.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,19 @@ public RoomListDto getAllRooms(final Long userId) {

@Transactional(readOnly = true)
public RoomListDto.RoomDto createRoomDto(final User user, final Room room) {
int sentence = 3, emotion = 0;
Profile myProfile = profileRetriever.findByUserAndRoom(user, room);
if (!profileRetriever.existsByUserNotAndRoom(user, room)){
return RoomListDto.RoomDto.of(
room.getId(),
room.getName(),
"-",
myProfile.getRelation().getContent(),
"-",
emotion,
sentence
);
}
Profile opponentProfile = profileRetriever.findByUserNotAndRoom(user, room);
Answer myAnswer = answerRetriever.findFirstByProfile(myProfile);
Answer opponentAnswer = answerRetriever.findFirstByProfile(opponentProfile);
Expand All @@ -87,9 +99,8 @@ public RoomListDto.RoomDto createRoomDto(final User user, final Room room) {
boolean opponentState = opponentAnswer.getContent() != null;

// 감정 측정 시 업데이트
int emotion = getEmotion(opponentProfile.getEmotion());
emotion = getEmotion(opponentProfile.getEmotion());

int sentence;
if (myState && opponentState) {
sentence = 0;
} else if (myState) {
Expand Down

0 comments on commit eae6a94

Please sign in to comment.