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/#283] 아티클 개수가 10의 배수일 경우 마지막 스크롤에서 isLast=false로 응답되는 문제 해결 #284

Merged
merged 2 commits into from
Aug 3, 2024

Conversation

hun-ca
Copy link
Member

@hun-ca hun-ca commented Aug 3, 2024

🎫 연관 이슈

resolved #283

💁‍♂️ PR 내용

  • as-is: DB에서 Limit 10으로 조회 후 10개가 조회되었다면 isLast = false로 응답
    • 아티클이 10의 배수로 존재할 경우 문제될 수 있음: 마지막 스크롤에서 10개를 응답했지만 isLast = false로 응답됨
  • to-be: DB에서 조회시 limit 11로 조회하여 조회된 개수가 11개일 경우 isLast = false, 그렇지 않을 경우 isLast = true로 응답

🙏 작업

🙈 PR 참고 사항

📸 스크린샷

🤖 테스트 체크리스트

  • 체크 미완료
  • 체크 완료

@hun-ca hun-ca self-assigned this Aug 3, 2024
@hun-ca hun-ca requested a review from belljun3395 as a code owner August 3, 2024 08:50
@github-actions github-actions bot added the fix 기능을 고칠 때 사용됩니다 label Aug 3, 2024
Copy link
Member Author

@hun-ca hun-ca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아티클 스크롤시 응답 필드 중 isLast 필드에 대한 오류 수정 작업입니다.
확인 부탁드립니다!

Comment on lines -91 to +90
).limit(10)
).limit(11)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조회수 상위 10개 아티클 ID를 조회할 때 10개가 아닌 11개로 일단 조회

Comment on lines +45 to +50
val isLast = if (articleViewsRecords.size == 11) {
articleViewsRecords.removeAt(10)
false
} else {
true
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11개를 조회한 뒤, 그 개수가 11개일 경우에만 해당 스크롤의 isLast 필드를 false로 응답. 그렇지 않으면 true

Comment on lines 6 to +7
enum class CategoryType(val code: Byte, val displayName: String) {
All(-1, "전체"), // Should not be stored in the DB
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 PR과는 무관하지만 아티클 전체 카테고리 추가되었습니다

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Collaborator

@belljun3395 belljun3395 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다!

Comment on lines -100 to +107
return ReadArticlesUseCaseOut(articleUseCaseOuts, sortedArticles.size != 10)
return ReadArticlesUseCaseOut(articleUseCaseOuts, isLast)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스크린샷 2024-08-03 오후 6 20 59

여기서 10보다 작다로 하면 되는거 아닌가요..?

@hun-ca hun-ca merged commit 9b111d9 into main Aug 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 기능을 고칠 때 사용됩니다
Projects
None yet
Development

Successfully merging this pull request may close these issues.

아티클 목록 조회시 isLast 필드 설정 오류 수정
2 participants