Skip to content

Commit

Permalink
[FIX] 엔딩 페이지 한쪽에서만 뜨는 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongseop committed Feb 27, 2024
1 parent dceb65e commit f63c7ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,20 @@ else if (childList.get(3) != YES || parentList.get(3) != YES) {
public GetMainViewResponseDto getMainInfo(Long userId) {

// updateUserFirstEntry(userId);

Parentchild parentchild = getParentchild(userId);

User user = getUserById(userId);
Parentchild parentchild = user.getParentChild();
List<QnA> qnaList = getQnAListByParentchild(parentchild);

QnA currentQnA = qnaList.get(parentchild.getCount()-1);
log.info("getCount(): {}", parentchild.getCount());

if (parentchild.getCount() == 7 && (currentQnA.isParentAnswer() && currentQnA.isChildAnswer())) {
if (parentchild.getCount() == 7 && (currentQnA.isParentAnswer() && currentQnA.isChildAnswer()) && !user.isEndingDone()) {
return GetMainViewResponseDto.of(currentQnA, -1); // 유효하지 않은 -1로 반환 시 엔딩이벤트
} else if (parentchild.getCount() == 8) {
QnA lastQnA = qnaList.get(6);
if ((lastQnA.isParentAnswer() && lastQnA.isChildAnswer()) && !user.isEndingDone()) {
return GetMainViewResponseDto.of(currentQnA, -1);
}
}

return GetMainViewResponseDto.of(currentQnA, parentchild.getCount());
Expand All @@ -396,7 +400,9 @@ public FirstEntryResponseDto updateUserFirstEntry(Long userId) {

@Transactional
public void restartQna(Long userId) {
Parentchild parentchild = getParentchild(userId);
User user = getUserById(userId);
user.updateIsEndingDone();
Parentchild parentchild = user.getParentChild();

if (parentchild.getCount() == 8) {
// 상대측이 이미 답변 이어가기를 호출했다면 실행할 필요 X
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public void updateFcmToken(String fcmToken) {

private boolean isFirstEntry = Boolean.TRUE;

private boolean isEndingDone = Boolean.FALSE;

// 로그인 새롭게 할 때마다 해당 필드들 업데이트
public void updateSocialInfo(String socialNickname, String socialProfileImage, String socialAccessToken/*, String socialRefreshToken*/) {
this.socialNickname = socialNickname;
Expand All @@ -126,6 +128,8 @@ public void updateIsFirstEntry() {
this.isFirstEntry = false;
}

public void updateIsEndingDone() { this.isEndingDone = true; }

public void deleteSocialInfo() {
this.socialPlatform = SocialPlatform.WITHDRAW;
this.socialNickname = null;
Expand Down

0 comments on commit f63c7ff

Please sign in to comment.