Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 엔딩 페이지 한쪽에서만 뜨는 오류 수정 #134

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading