-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,19 @@ class ReadArticlesUseCase( | |
} | ||
|
||
// 이번 스크롤에서 보여줄 아티클 ID에 대한 기준 (Criterion) | ||
val articleViewsRecords: Set<SelectArticleViewsRecord> = articleViewCountDao.selectArticlesOrderByViews( | ||
val articleViewsRecords: MutableList<SelectArticleViewsRecord> = articleViewCountDao.selectArticlesOrderByViews( | ||
SelectArticlesOrderByViewsQuery( | ||
offset, | ||
CategoryType.fromCode(useCaseIn.categoryCd) | ||
) | ||
) | ||
).toMutableList() | ||
|
||
val isLast = if (articleViewsRecords.size == 11) { | ||
articleViewsRecords.removeAt(10) | ||
false | ||
} else { | ||
true | ||
} | ||
Comment on lines
+45
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 11개를 조회한 뒤, 그 개수가 11개일 경우에만 해당 스크롤의 |
||
|
||
// 2. TODO: 조회한 10개의 아티클 아이디를 기반으로 로컬 캐시에 있는지 조회(아티클 단건조회 캐시 사용) | ||
// 3. TODO: 로컬캐시에 없으면 ARTICLE_MAIN_CARD 테이블에서 데이터가 있는지 조회 (컨텐츠는 article_ifo에서) | ||
|
@@ -97,12 +104,12 @@ class ReadArticlesUseCase( | |
) | ||
}.toList() | ||
|
||
return ReadArticlesUseCaseOut(articleUseCaseOuts, sortedArticles.size != 10) | ||
return ReadArticlesUseCaseOut(articleUseCaseOuts, isLast) | ||
Comment on lines
-100
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
private fun updateAndSortArticleViews( | ||
articleRecords: Set<ArticleMainCardRecord>, | ||
articleViewsRecords: Set<SelectArticleViewsRecord>, | ||
articleViewsRecords: List<SelectArticleViewsRecord>, | ||
): Set<ArticleMainCardRecord> { | ||
val sortedSet = TreeSet( | ||
Comparator<ArticleMainCardRecord> { a1, a2 -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ package com.few.data.common.code | |
* @see com.few.batch.data.common.code.BatchCategoryType | ||
*/ | ||
enum class CategoryType(val code: Byte, val displayName: String) { | ||
All(-1, "전체"), // Should not be stored in the DB | ||
Comment on lines
6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 해당 PR과는 무관하지만 아티클 전체 카테고리 추가되었습니다 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
ECONOMY(0, "경제"), | ||
IT(10, "IT"), | ||
MARKETING(20, "마케팅"), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
조회수 상위 10개 아티클 ID를 조회할 때 10개가 아닌 11개로 일단 조회